Computer Science Canada Saving highscore onto hard drive (I've looked at other "help" attemts but im still really confused) |
Author: | chipanpriest [ Mon Dec 05, 2011 7:43 pm ] |
Post subject: | Saving highscore onto hard drive (I've looked at other "help" attemts but im still really confused) |
What is it you are trying to achieve? Hey guys. I'm making a game that involves a score and a highscore. I have the score and highscore when you play the game. I'm still confused about how to save your highscore to the user's hard drive and be able to recover it again when the user starts the program again. What is the problem you are having? I'm having troubles understanding all this "open :, get :, put :, etc" Describe what you have tried to solve this problem I've searched the web and seen people try to explain this but I'm a little bit new at Turing and I don't understand all the advanced things in Turing so if anyone could explain this simply I would appreciate it. Please specify what version of Turing you are using <4.1.1> |
Author: | Dreadnought [ Mon Dec 05, 2011 7:54 pm ] |
Post subject: | Re: Saving highscore onto hard drive (I've looked at other "help" attemts but im still really confused) |
Perhaps this tutorial will help with your problem. http://compsci.ca/v3/viewtopic.php?t=12972 Hope it helps. |
Author: | mirhagk [ Mon Dec 05, 2011 7:54 pm ] | ||||
Post subject: | RE:Saving highscore onto hard drive (I\'ve looked at other "help" attemts but im still really confused) | ||||
So the first thing you need to do is open up the file, you use open to do that such as the following
That will give you an integer value that corresponds to an internal value that Turing uses to know which file you're talking about. You use this whenever you do anything with this file. The get and put just go on the end, and you can just use one or the other if your just getting or putting, It;s just to tell the file how you want to use it. So basically all you need to do know is put or get from the file pretty much just like you would window only you use : stream, after the put or get like the following
|
Author: | programmer1337 [ Mon Dec 05, 2011 8:09 pm ] | ||
Post subject: | Re: Saving highscore onto hard drive (I've looked at other "help" attemts but im still really confused) | ||
ill give you an example of a top 3 highscore thingy i made
|
Author: | ttm [ Mon Dec 05, 2011 8:10 pm ] | ||||
Post subject: | Re: Saving highscore onto hard drive (I've looked at other "help" attemts but im still really confused) | ||||
Hi there; I wrote a super handy highscore module which I use in all my games. You might want to use it as an example or try to figure out how it works.
An example of how to use it would be
This uses the file input and output methods mentioned previously, but the only thing that might be a bit complicated is the _rebalance procedure, which sorts the highscore list using insertation sort. You can read about that here: http://en.wikipedia.org/wiki/Insertion_sort. |
Author: | ttm [ Mon Dec 05, 2011 8:11 pm ] |
Post subject: | Re: Saving highscore onto hard drive (I've looked at other "help" attemts but im still really confused) |
Oops just noticed programmer1337's post. Sorry mybad. |
Author: | programmer1337 [ Mon Dec 05, 2011 8:12 pm ] | ||
Post subject: | Re: Saving highscore onto hard drive (I've looked at other "help" attemts but im still really confused) | ||
this is much simpler then ^ and you would prolly get it
|
Author: | chipanpriest [ Mon Dec 05, 2011 8:48 pm ] |
Post subject: | RE:Saving highscore onto hard drive (I\'ve looked at other "help" attemts but im still really confused) |
haha thanks guys i got it to wrk after the mirhagk person replied but thanks anyways ;D |