• 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!

Windows looping object change

K

krakk

Guest
Hi, i'm struggling to make a looking object change,

I'm managing to change one time, then it stops.

I have this code in the 1ºst obj:


Code:
Create Event:

set Alarm 0 to 45
execute code:

image_speed = 0.2

Alarm Event for alarm 0:

set Alarm 0 relative to 100
change the instance into object lavafall2end, not performing events
Begin Step Event:

execute code:

image_speed = 0.2;

Other Event: Animation End:

set the sprite to lavafall2 with subimage 0 and speed 0.2

and then this on the 2nd obj:
Code:
Create Event:

set Alarm 0 to 45
execute code:

image_speed = 0.2

Alarm Event for alarm 0:

set Alarm 0 relative to 100
change the instance into object lavafall2begin, not performing events
Other Event: Animation End:

execute code:

image_speed = 0;
image_index = image_number - 1;

what may be the problem?
 

FrostyCat

Redemption Seeker
You need to enable performing events when changing the instance to another object. Your initial alarm sets are in the Create event, and disabling performing events would have skipped that.
 
K

krakk

Guest
In fact, they do the loop, but the 1st object starts with a sprite and then it changes to another in the animation end. When it loops, it goes to the second sprite and ignores the first one. like this:


obj1:
sprite_begin > animation end > sprite2 > timer > change to obj2

obj2:
sprite_end > timer > change to obj1

So, it run ok the 1st time, then when it loops, the obj1 shows the sprite2 and don't start with the sprite_begin.
 
Top