Legacy GM Alarms and Code

E

Ezled

Guest
Hello again! A have a question...

For example:
Code:
CREATE EVENT
image_speed = 0;
alarm[0] = 120;
image_index = 1;
This code will make the sprite change to the 2nd image after 4 seconds after 120 steps right? Or alarms don't work like this in code?
 
R

Ryzzax

Guest
For the time in alarms, if your room is 60 frames per seconds, then for 4 seconds, it shoud be 240. If your room is 30 frames per second, then it shoud be 120.
 

Roa

Member
Hello again! A have a question...

For example:
Code:
CREATE EVENT
image_speed = 0;
alarm[0] = 120;
image_index = 1;
This code will make the sprite change to the 2nd image after 4 seconds after 120 steps right? Or alarms don't work like this in code?
Almost. The image_index=1 would have be under the alarm event.
 
E

Ezled

Guest
So i need to use the Alarm Event....

Is there a simple way to count time with only scripts?

I want to show a text when the player get in collision with an object for X time, then it'll fade away.

Like in metroid when you get a upgrade.
 

Roa

Member
I mean, you could always make a variable that counts down in loop.
create
Code:
var_timer=-1
step
Code:
if var_timer=-1 { timer=120; }
if var_timer>0 {//do stuff}
var_timer--
It's much easier to use and reuse an alarm.
 
Top