T
Tyler
Guest
Hello,
I have been trying to create code that plays an animation if the player is inactive for an extended period of time (similar to how Mario will fall asleep if you put the controller down for a while). So far I have been successful in making the animation play after a variable counter reaches 0, but every time the animation plays there are frames missing! I have tested the animation under normal circumstances and as far as I can tell the animation only skips frames in the context of my variable counter. I would greatly appreciate it if anyone knows the solution to my problem. Here are the basics to my code:
//Create Event
image_speed = 0.1;
timer = 60;
stopped = spr_player_stopped;
wait = spr_player_wait;
//Step Event
if (keyboard_check(vk_nokey))
{
sprite_index = stopped;
timer -= 1;
if (timer <= 0) sprite_index = wait;
}
else timer = 60;
I hope this code is clear enough. I am not sure if this is also useful information, but spr_player_stopped has 4 frames of animation, spr_player_wait has 8 frames of animation, and the game runs at 60 frames per second.
Thank you!
I have been trying to create code that plays an animation if the player is inactive for an extended period of time (similar to how Mario will fall asleep if you put the controller down for a while). So far I have been successful in making the animation play after a variable counter reaches 0, but every time the animation plays there are frames missing! I have tested the animation under normal circumstances and as far as I can tell the animation only skips frames in the context of my variable counter. I would greatly appreciate it if anyone knows the solution to my problem. Here are the basics to my code:
//Create Event
image_speed = 0.1;
timer = 60;
stopped = spr_player_stopped;
wait = spr_player_wait;
//Step Event
if (keyboard_check(vk_nokey))
{
sprite_index = stopped;
timer -= 1;
if (timer <= 0) sprite_index = wait;
}
else timer = 60;
I hope this code is clear enough. I am not sure if this is also useful information, but spr_player_stopped has 4 frames of animation, spr_player_wait has 8 frames of animation, and the game runs at 60 frames per second.
Thank you!