Windows looping object change

krakk

Member
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

Member
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.
 

krakk

Member
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