Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Outside of any functions...
- double lastBlinkTime;
- static const double blinkInterval = 500;
- // A function that is called once at the start of the game...
- void Init()
- {
- lastBlinkTime = 0.0; // Or you can use the current time, doesn't matter really at this point
- }
- // A function that is called every frame
- void Update()
- {
- // Here you should use whatever you have available to get the current time in ms
- double curTime = getCurrentTimeInMilliseconds();
- if(curTime > lastBlinkTime + blinkInterval)
- {
- lastBlinkTime = curTime;
- // Do whatever blinking code you need to here.
- }
- }
Add Comment
Please, Sign In to add comment