Finishing game after certain time range

H

howdiie

Guest
How do I insert a time range so that my game ends after say 4 minutes
 
S

Snail Man

Guest
Create a controller object, and in the create event, use the alarm set action (or type alarm[0] = ...) to set an alarm to 4 minutes (the time is measured in steps, and fps is in steps per second, so 4 minutes would be room_speed*60*4)
Then in the alarm event, just put the code you need when the time is up.
 
J

jirrev

Guest
Create a controller object, and in the create event, use the alarm set action (or type alarm[0] = ...) to set an alarm to 4 minutes (the time is measured in steps, and fps is in steps per second, so 4 minutes would be room_speed*60*4)
Then in the alarm event, just put the code you need when the time is up.
This will indeed work most of the time, but if your pc can't run the number of frames room_speed defines it will start to lag behind, to solve this you can use:

Code:
create:
time = 60 * mins;

step:
time = (time - (delta_time*1.000.000))
if(time <= 0)
{
//do something
}
the delta_time will solve the problem of lagg and will make sure it always takes 4 minutes (unless the last frame takes longer then expected, but that can't be solved)
 
H

howdiie

Guest
Thankyou snailman and jirrev for replies I will try your code jirrev - thanks again
 
Top