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

SOLVED Changing Alarm Values

Wonsubon

Member
I've been rather confused about the values of alarms. The docs weren't too clear from what I read from them either, so I ask is it possible to increase, decrease, multiply, and/or divide the value of an alarm after it has been set? Here's an example of what I mean by this:
GML:
// In the create event

alarm[0] = room_speed * 6;

//In collision event

alarm[0] -= 60;
Any advice and things to know on alarms would be great as well
 

Nidoking

Member
An alarm value is a number. Anything you can do with a number, you can do with the number that is the alarm value. I recommend keeping them as integers, though. Both of your examples are fine, generally, although you might want to watch in the latter case that you're not going too far into the negatives. That might skip the alarm entirely, which might not be what you want to happen.
 

Wonsubon

Member
An alarm value is a number. Anything you can do with a number, you can do with the number that is the alarm value. I recommend keeping them as integers, though. Both of your examples are fine, generally, although you might want to watch in the latter case that you're not going too far into the negatives. That might skip the alarm entirely, which might not be what you want to happen.
GML:
if alarm[0]>0 alarm[0] = max(1,alarm[0]-60);
it triggers when going from 1 to 0 .. then it goes to -1 where it stays, so if you lower it then stop at 1 if you want it to trigger
This really helped, thank you so much!
 
Top