• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Axe Attack

S

Shrek Trekker

Guest
Hey Mates, I could use some help here with my attack code. I am trying to get my player to attack but he only changes from the idle stance to the first frame of the 3 frame attack. What am I doing wrong? What should I do? Here is my code, it is real beginner. My player starts with an idle sprite.

in create:
amIaxing = false;

in the step:
if (keyboard_check_pressed(ord("X")) and amIaxing = false)
{
amIaxing = true;
sprite_index = sprPlayerAxe;
image_speed = 0.5; //may need adjustment? Room Speed is 60.
}

in the endstep:
if (sprite_index = sprPlayerAxe and image_index > 2)
{
sprite_index = sprPlayerIdle;
amIaxing = false;
}
 

wamingo

Member
you forget to set the image_index back to zero when you swing.

also try setting image_speed really low for testing purposes, 0.025 or something.
 
A

Ayziak

Guest
Is it possible that it only displays the first or second frame of the sprite? I've always found that testing for sprite_index can sometimes leave a delay or the opposite. I would troubleshoot in the way Wamingo suggested, but if that doesn't work, try using a timeline or an alarm instead.
 
W

Wild_West

Guest
you forget to set the image_index back to zero when you swing.

also try setting image_speed really low for testing purposes, 0.025 or something.
Wow you really know your stuff guy, I was having an issue with one of my enemies animating, and using your suggestion worked perfectly
 
Top