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.

DarkBASIC Professional Discussion / Issues with highscore and background image....

Author
Message
Sgt Johnson
15
Years of Service
User Offline
Joined: 17th May 2011
Location:
Posted: 17th May 2011 20:26
I've been trying to make a high score code that enables others to see their past score each time they try to play. Right now I just have this:

` Load
gosub LoadHighScore

` Save
gosub SaveHighScore




LoadHighScore:
if file exist("Hiscore.dat")
open to read 1, "Hiscore.dat"
read long 1, HighScore
close file 1
endif
return

SaveHighScore:
if file exist("Hiscore.dat") then delete file "Hiscore.dat"
open to write 1, "Hiscore.dat"
write long 1, HighScore
close file 1
return

Also, I have tried setting my background image as a bitmap. The background image shows up but then gets rid of the actual platforms that are needed to reach the objects. My code is down below, you may just have to delete the image codes since you do not have the files. Thank you.
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 17th May 2011 23:34
you have to read the file into an array then sort this array. then re-write everything on the file again.
Cor
AGK Developer
15
Years of Service
User Offline
Joined: 19th Dec 2010
Location: Its a trap!
Posted: 18th May 2011 01:03
Are you trying to read just one past score or a list of the past scores?
Sgt Johnson
15
Years of Service
User Offline
Joined: 17th May 2011
Location:
Posted: 18th May 2011 18:55
Just one past score.
Scraggle
Moderator
23
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 18th May 2011 20:11
So what's the problem?

Since you only want to save/load a single score then your code seems perfectly OK.

luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 18th May 2011 20:43
Check this out it may help you(or not).You can easily convert the demo to match your needs if it's what you are looking for.

http://forum.thegamecreators.com/?m=forum_view&t=169546&b=6

Coding is My Kung Fu!
And My Kung Fu is better than Yours!

Login to post a reply

Server time is: 2026-07-10 23:13:27
Your offset time is: 2026-07-10 23:13:27