GameMaker Alarms and delta_timing

Amon

Member
You would have to write your own timers.
Would I, for example, decrease or increase them using the delta_timer, for them to work correctly? Can you give us an example if permitted?

I've done various searches on the net and there are so many different solutions with each contradicting the other hence my need to start this thread.

Thanks!
 
Last edited:

Amon

Member
Can anybody point me to a solution of custom timers that work with deltatiming code?

Sorry if this is simple to do.
 

GMWolf

aka fel666
Timers are the simplest thing to implement using delta timing.
If you cannot figure them out, perhaps DT is too big a step.
 
M

Marcus12321

Guest
You can count up or down, it is up to you. You either set a variable to 500ms, then subtract from it, or you set a variable to 0 and count up to 500. Totally up to you how you want to do it.
 

Amon

Member
ok, I seem to have worked it out.

I created a script called scr_delta_alarm. Inside it I put:
/// scr_delta_alarm(n);
n = argument[0];
return n * 1000000;

In my Objects Create Event I put:

delta_alarm = scr_delta_alarm(3);

In the Objects Step event I put Frostys code I found on the forum:

if (delta_alarm > 0) {
delta_alarm -= delta_time;
if (delta_alarm <= 0) {
instance_create_layer(x,y,"Instances",objBullet);
delta_alarm = scr_delta_alarm(3);
}
}

It works lovely. Thanks all.
 
I

icuurd12b42

Guest
create
alarm = get_timer() + 1000000 * 3;

step
if (get_timer() > alarm)
{
//tic toc
alarm = get_timer() + 1000000 * 3;
}
 
Top