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.
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: