Hello Cemetech! I have started to get comfortable in CE C, so I decided to make a simple game where you have to collect as many coins as possible in a certain amount of time. I have all the movement, collision detection, coin counting, etc. done, but still need to figure out how to display a timer on the screen. I looked at the examples in the toolchain and read the documentation, but could not get it to work. Can somebody help me out please? Thank you in advance!

EDIT: I would like the timer to count down from 1 minute
What kind of timer do you want?

You can modify this example for your purposes: https://github.com/CE-Programming/toolchain/blob/master/examples/standalone/stopwatch/src/main.c

All you have to do is change the timer to count down rather than up.


Code:
timer_Set(1, 32768 * 60);
timer_Enable(1, TIMER_32K, TIMER_0INT, TIMER_DOWN);
uint24_t count = (uint24_t)timer_GetSafe(1, TIMER_DOWN);
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement