SOLVED: Instance_Create with Alarm event

C

CJ K

Guest
Good Morning, I have an alarm[0] that in 3 seconds I want the alarm to trigger and create an instance of an object after I press my action button. Any help would be appreciated.

I created a alarm[0] event with the following:

instance_create(x,y,obj_Garage_Door_Up)

In my step event of the object I have the following:


///Hero Interaction

var dist = point_distance(obj_Hero.phy_position_x, obj_Hero.phy_position_y, phy_position_x, phy_position_y);
///show_debug_message(string(dist));
if(dist < 128){

if(obj_Hero.action == true){

if(alarm[0]<0)
{
alarm[0] = room_speed *3;
}
}
}
 
Hey CJ K. If I remember correctly, you wanted your new garage door object to appear after the opening animation was finished with your garage door right?
Why not add the instance_create(x,y,obj_Garage_Door_Up); code right before the instance_destroy(); code in your opening door object?
That way when you press the action button to open the garage, the door will open, disappear, and then spawn the new open door all at the same time seamlessly.
 
C

CJ K

Guest
Thanks for the reply Silver_Mantis. That is actually the code I had in there before. However...

The only issue with that is when I close the garage door, the closed pictures snaps closed before the animation is done. The reason I was thinking the alarm would work is so that the animation had 3 seconds to complete before the solid closed object appeared.
 
Thanks for the reply Silver_Mantis. That is actually the code I had in there before. However...

The only issue with that is when I close the garage door, the closed pictures snaps closed before the animation is done. The reason I was thinking the alarm would work is so that the animation had 3 seconds to complete before the solid closed object appeared.
Hmm. Is the closed door the last frame in your animation? If that is the case, the open one should be the last frame so when it plays, it wont show that frame before it's gone.
Normally when I link my animations together, I use the Animation End Event which you are familiar with by now so now need to restate that lol.
 
C

CJ K

Guest
Okay, So I feel silly. That worked great. I was actually putting the instance_create in my step event and that's why it wasn't working. That animation end event is actually turning out way more useful than I realized. Thanks again, God Bless!
 
Okay, So I feel silly. That worked great. I was actually putting the instance_create in my step event and that's why it wasn't working. That animation end event is actually turning out way more useful than I realized. Thanks again, God Bless!
Haha any time my friend! Peace be with you also!
 
Top