Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / User Input, Keeping Time, Storing Highscores

Author
Message
jagudack
8
Years of Service
User Offline
Joined: 28th Apr 2012
Location:
Posted: 29th Apr 2012 08:02
I made a game where a user navigates a character through a maze.

I want to do 3 things that I am not sure how to do.

1) I want the user to enter their name

2) I want a timer to start and display, and stop when the user reaches the end of the maze. (Timer could be replaced by a steadily increasing score if necessary)

3) I want the times to be sorted and stored in a highscore file, and the top 5 scores are displayed

Any input on how I could do this would be well appreciated. Thanks!
DeadTomGC
10
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 30th Apr 2012 02:29
There are lots of ways to take input. I don't know the best way to do that, but I would probably just make my own custom input taker based on key hits using the KeyState Command.

For the timer, I suggest having a counter that just increases in value every refresh while using the text command to display your current time. no. of seconds = counter/60

For the high score file, you could use the fstream header to store info in a text file. When ever you get a new score just check to see if it is in the top 5 and then store it.


WLGfx
12
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 30th Apr 2012 03:33
You could use the Win32 timer functions like this:



Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!

Login to post a reply

Server time is: 2020-09-24 21:16:51
Your offset time is: 2020-09-24 21:16:51