frame-based timers

Ideas for Game Editor evolution.

frame-based timers

Postby j2graves » Fri May 08, 2009 5:16 pm

it's often difficult to work with real-time timers, because sometimes the game lags and so things work slower, but the timers stay exactly the same, causing things to happen at the wrong time. having a frame-based timer would fix this up easily :)
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: frame-based timers

Postby asmodeus » Fri May 08, 2009 7:40 pm

That is a really good thing! I propably would also need it! I could do it with a variable increasing / decreasing in each frame, but a built in frame timer would really help! :D
User avatar
asmodeus
 
Posts: 483
Joined: Thu Oct 11, 2007 5:04 pm
Location: Germany
Score: 43 Give a positive score

Re: frame-based timers

Postby Fuzzy » Sat May 09, 2009 4:42 am

You can make one. Make a global integer called frameNumber. In the create actor event for view, set it to zero. In draw actor event for view, add one to it.

Now say you want an actor to do something every 12 frames. Give the actor a variable of type int and set it to 12. Maybe the timer is called blinkRed. In draw actor, say

Code: Select all
if ((frameNumber % blinkRed) == 0)
{
    do stuff
}
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: frame-based timers

Postby Hblade » Mon May 18, 2009 7:15 pm

If you want, I could make a script that will use frame based timers.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 1 guest