C
Crysillion
Guest
Essentially, I have a sword and inside the image index of the sword is multiple different swing animations. Frames 0~4 are a swing down, frames 5~8 are a swing up, for example.
I want to make it so when you use the LMB, frames 1, 2, 3 are played, but then it stops there. The next time you press LMB, it plays 5, 6, 7 then back to 0.
Wrapping my head around making it so the weapon starts with an image_speed of 0 and then increases when the player LMB's was easy enough, but having it stop somewhere in the middle is the hard part.
This is what I've tried:
When I do LMB, it animates. The problem is that it keeps animating. If I mash LMB, sometimes it will stop the way that it should.
What am I doing wrong?
I want to make it so when you use the LMB, frames 1, 2, 3 are played, but then it stops there. The next time you press LMB, it plays 5, 6, 7 then back to 0.
Wrapping my head around making it so the weapon starts with an image_speed of 0 and then increases when the player LMB's was easy enough, but having it stop somewhere in the middle is the hard part.
This is what I've tried:
Code:
if (mouse_check_button_pressed(mb_left) && lmbcombo == 0)
{
image_speed = 30;
if (image_index == 3) image_speed = 0;
lmbcombo = 1;
}
if (mouse_check_button_pressed(mb_left) && lmbcombo == 1)
{
image_speed = 30;
if (image_index == 7)
{
image_index = 0;
image_speed = 0;
}
lmbcombo = 0;
}
What am I doing wrong?