What I planned to create:
When I press the key "E", the sprite will play from the first frame, and when it reaches the last frame, it will stop.
When I press "E" again, the sprite will play reversely from the last frame till the first frame and stop.
Create:
Key Press - E
Step
But when I walk towards the lamp(within the 50 pixel radius), and pressed "E", nothing happens.
Anyone can help?
When I press the key "E", the sprite will play from the first frame, and when it reaches the last frame, it will stop.
When I press "E" again, the sprite will play reversely from the last frame till the first frame and stop.
Create:
GML:
image_speed = 0;
on_off = 0;
GML:
if distance_to_object(obj_player1) <= 50 {
if on_off = 0 {
on_off = 1;
}
if on_off = 1 {
on_off = 2;
}
}
GML:
if on_off = 1 {
image_speed = 1;
if image_index = 2 {
image_speed = 0;
}
on_off = 0
}
if on_off = 2 {
image_speed = -1
if image_index = 0 {
image_speed = 0;
}
on_off = 0
}
Anyone can help?
Attachments
-
49.6 KB Views: 1
-
21.5 KB Views: 1