Guest User

Untitled

a guest
Jan 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. // Outside of any functions...
  2. double lastBlinkTime;
  3. static const double blinkInterval = 500;
  4.  
  5. // A function that is called once at the start of the game...
  6. void Init()
  7. {
  8. lastBlinkTime = 0.0; // Or you can use the current time, doesn't matter really at this point
  9. }
  10.  
  11. // A function that is called every frame
  12. void Update()
  13. {
  14. // Here you should use whatever you have available to get the current time in ms
  15. double curTime = getCurrentTimeInMilliseconds();
  16.  
  17. if(curTime > lastBlinkTime + blinkInterval)
  18. {
  19. lastBlinkTime = curTime;
  20.  
  21. // Do whatever blinking code you need to here.
  22. }
  23. }
Add Comment
Please, Sign In to add comment