A
AngelofGamin
Guest
The issue: even if I change the speed values, the jumping animation remains a constant speed. The walking animation I can control just fine.
[UPDATE: AS IT TURNS OUT, THE PROBLEM IS ENTIRELY DIFFERENT]
It's not that the animation frame stays a constant speed, I tested a different sprite and as it turns out, it only plays the second frame and leaves out the rest.
Step code:
[UPDATE: AS IT TURNS OUT, THE PROBLEM IS ENTIRELY DIFFERENT]
It's not that the animation frame stays a constant speed, I tested a different sprite and as it turns out, it only plays the second frame and leaves out the rest.
Step code:
Code:
// Get input
key_Left = -keyboard_check(vk_left); key_Right = keyboard_check(vk_right); key_Jump = keyboard_check_pressed(vk_up);
// Use input
move = key_Left + key_Right; hsp = move * moveSpeed; if (vsp < 10) { vsp += grav; };
if (place_meeting(x, y + 1, obj_jwall)) { vsp = key_Jump * -jumpSpeed }
if (key_Jump) && (place_meeting(x+1,y,obj_jwall) || place_meeting(x-1,y,obj_jwall))
{
vsp = key_Jump * -jumpSpeed;
}
// H Collisions
if (place_meeting(x + hsp, y, obj_jwall)) { while (!place_meeting(x + sign(hsp), y, obj_jwall)) { x += sign(hsp); } hsp = 0; } x += hsp;
// v Collisions
if (place_meeting(x, y + vsp, obj_jwall)) { while (!place_meeting(x, y + sign(vsp), obj_jwall)) { y += sign(vsp); } vsp = 0; } y += vsp;
// Animations
if (!place_meeting(x,y+1,obj_jwall))
{
sprite_index = sp_jplayerjump;
image_speed = 0;
if (sign(vsp) > 0) image_index = 1; else image_index = 0;
}
else
{
image_speed = 1;
if (hsp == 0)
{
sprite_index = sp_jplayer;
}
else
{
sprite_index = sp_jplayerwalk;
image_speed = .15;
}
}
if (hsp != 0) image_xscale = sign(hsp);
Last edited by a moderator: