Windows Tons of annoying bugs.

S

Scorpio757

Guest
So I'm currently developing the first project I intend to publish on steam or some other platform and I need some help dealing with a few bugs. The list of problems just goes on and any help at all would be fantastic. I would like to point out I am relatively new with GameMaker.
The main thing I'm working on right now is prepping my movement code (For a platformer style game) for all the animated sprites I'm hoping to add. One of the problems I'm having is the player object not switching between sprites and instead only using the temporary idle sprite. This is the code I've got so far in the step event.
Code:
///Physics/Movement
if(keyboard_check(ord("A"))) {
    hspeed -= Move_Speed;
    if(hspeed < Move_Speed) { hspeed = -Move_Speed};
    //Set Sprite
    if(hspeed = -10) { object_set_sprite(obj_Player, spr_Player_Running)};
    object_set_sprite(obj_Player, spr_Player_Turn);
    alarm[0] = 1*room_speed/2;
    image_xscale = -1;
} else {
    if(hspeed < 0) {
        hspeed += Friction;
        //Set Sprite
        object_set_sprite(obj_Player, spr_Player_Idle);
        image_xscale = -1;
    }
}
if(keyboard_check(ord("D"))) {
    hspeed += Move_Speed;
    if(hspeed > Move_Speed) { hspeed = Move_Speed};
    //Set Sprite
    if(hspeed = 10) { object_set_sprite(obj_Player, spr_Player_Running)};
    object_set_sprite(obj_Player, spr_Player_Turn);
    alarm[0] = 1*room_speed/2;
    image_xscale = 1;
} else {
    if(hspeed > 0) {
        hspeed -= Friction;
        //Set Sprite
        object_set_sprite(obj_Player, spr_Player_Idle);
        image_xscale = 1;
    }
}
if(keyboard_check(vk_shift)) {
    Move_Speed = 10;
} else {
    if(keyboard_check_released(vk_shift)) {
        Move_Speed = 5;
    }
}
if(!place_meeting(x, y+2, obj_Block_Basic)) {
    vspeed += 0.3;
    if(keyboard_check_pressed(vk_space)&& D_Jump = 1) {
        if(vspeed > 0) {
            vspeed = 0;
            vspeed -= 6;
            D_Jump = 0;
        } else {
            vspeed -= 6;
            D_Jump = 0;
        }
    }
} else {
    if(keyboard_check_pressed(vk_space)) {
        vspeed -= 8;
    }
}
//Collision
if(place_meeting(x, y+1, obj_Block_Basic)) {
    if(!vspeed = 0) {
        vspeed = 0;
        D_Jump = 1;
    }
}
 
Last edited by a moderator:

Paskaler

Member
Could you please post the code within
Code:
The way it is now, it's completely unreadable. [ CODE ] and [ /CODE ] without spaces.

What I can tell you right away is that you shouldn't be using object_set_sprite. That sets the sprite for all object instances. To change just for one instance use sprite_index.

sprite_index = spr_my_sprite;
 
S

Scorpio757

Guest
Could you please post the code within
Code:
The way it is now, it's completely unreadable. [ CODE ] and [ /CODE ] without spaces.

What I can tell you right away is that you shouldn't be using object_set_sprite. That sets the sprite for all object instances. To change just for one instance use sprite_index.

sprite_index = spr_my_sprite;
Thanks. And sorry about it being hard to read, this is the first time I've posted anything.
 
Top