How do I Create/Display a Clock

0 favourites
  • 3 posts
From the Asset Store
The clock has started ticking, but are you fast enough?
  • Hey there,

    I am trying to design an ingame clock. Normally I would just go by the current time or played time but I need the world time to be separate from "real life" time. I am thinking somewhere along the lines of 2 real-time hours to complete one 24 hour cycle in the game.

    I know that I will have to store the time locally/convert real-life time to game time and I can handle that, no problem. I am just stuck on how to display it as a clock.

    I was thinking of setting up a text that would divide the currentTime variable by 3,600 to equal each one hour. Then use the remainder and divide that by 60 to get the minutes. I could set a cap on the time so it would reset to 0 after 43,200 seconds (12 hours). I could also set a boolean for AM/AP so that I can keep track of the day/night cycles.

    Blah, I think I am on the right track. Anyone have an opinion or experience making something similar?



  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It kinda sounds like you've got it figured out? Which part exactly are you stuck on? I assume you mean digital clock as opposed to analog?

  • If I'm understanding correctly, it's just a timer which runs ~12x that of normal time?

    This might not be the ideal way, but, if I recall correctly when I had a time display I had a sprite font object with several variables (Days/Hours/Minutes). It'd constantly add dt to the Minutes variable, when Minutes >= 60 it'd add 1 to Hours and reset Minutes, etc. To display the time I'd just have it as "Set text to Days ':' Hours ':' round(Minutes)". In your case you can add dt*12 or something.

    To make it prettier maybe you can use several sprite fonts to have 0s when the variables are in single digits (e.g. 01:02:03 instead of 1:2:3).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)