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

Having trouble with alarms

V

valhallawarrior1

Guest
I am making a pretty basic top view tank game. I am trying to delay the time between your character dying and the menu popping up. I would like to make it so that when the hp gets to 0, it destroys the object, changes the object to an explosion, then after 5 seconds goes to the menu screen.

At this point I can either make it instantly go to the menu, or it can turn into an explosion, but will not change rooms. I thought my solution to this was to trigger an alarm to start counting down and then make an alarm that goes to the next room, but it never seems to trigger the alarm.

I am pretty new to GMS and I am currently doing a combination of coding and drag and drop options. If possible, I would like to learn how to code it. Thank you. I hope I gave you enough information to help.
 

Tthecreator

Your Creator!
What I think your problem might be is that you are destroying the object which has the alarm...
Are you setting the alarm for the player, because if you are and you are deleting your player, the alarm will never get triggered
If you have the alarm in your explosion object, then you should give some code.
 

jo-thijs

Member
Hi and welcome to the GMC!

Alarms will only trigger if the object in which they're set still exists by then.

I would suggest you create the explosion object, set its variable "visible" to false in its "other animation end" event and also set its alarm there to room_speed * 5.
In its alarm event, you'd then change rooms.
 
V

valhallawarrior1

Guest
Ahh, I never would have thought of that. Thank you! I will try those suggestions.
 
Top