Author Topic: How to make a timer? (again)  (Read 69 times)

Volod

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
How to make a timer? (again)
« on: January 12, 2020, 04:52:40 pm »
Hey... i am asking this question again, because the only answer, that i got on this question didn't help me... (It is about jo_get_ticks, but i didn't understand, how to use it)
So... how to create a comand that will be executed after a certain specified time, that i set, after starting the game (or after something else)? Can you please, give me an example as a code?

SuperReye

  • Newbie
  • *
  • Posts: 6
  • Karma: +2/-0
    • View Profile
    • Reye.me
Re: How to make a timer? (again)
« Reply #1 on: January 20, 2020, 04:45:32 pm »
Well, you could read the ticks the functions returns and convert that into seconds. That could tell you how much time has passed. But idk how many ticsk are in a second.
You can also count number of frames that have passed and since you know what FPS cap there is (60 for NTSC). You can say that when you count to 60 frames 1 second has passed.
This however can be a problem if your game does not run at stable framerate.

Edit: Here is a code of what I am using https://pastebin.com/TebNaJGf might be of some use to you.
You would need to modify it for your usecase however.
« Last Edit: January 20, 2020, 04:54:17 pm by SuperReye »

 

Sitemap 1 2 3 4 5 6 7 8 9 10 
SMF spam blocked by CleanTalk