Stop animation at an image

S

Stancho

Guest
Hey guys.

So i am trying to make my guy duck. the animation has 4 frames (first two going down, second two going up)
So i want to have the animation freeze on the second frame of the animation for as long as i press the duck key and then continue when i release the duck key.

please help. thanks
 
T

Thomas N

Guest
Hi,
I think you could put this in the step event of your object:

Code:
if keyboard_check(duck key){
image_speed = 0
image_index = 1}
and set it back with

Code:
if !keyboard_check(duck key){
image_speed = 1}
 
Last edited by a moderator:
D

Dracodino300

Guest
Hi,
I think you could put this in the step event of your object:

Code:
if keyboard_check(duck key){
image_speed = 0
image_index = 1}
Probably want to remove the image_speed = 0; there, as when you release the image wouldn't continue cycling.

The alternative would be to have:
Code:
if(keyboard_check_pressed(duck_key){
    image_speed = 0;
    image_index = 1;
}
else if(keyboard_check_released(duck_key){
    image_speed = 1;
}
 
Top