Hi
I'm presently looking around to find an answer / solution to this:
is there a way you can store a 'highest score' as in the real gaming machines... Each time you run the game you see the highest score so far to beat and if you beat it the highest score changes and so on?
Also (while i'm at it):
MODULE: KeyboardMovement v1.02: have heard you can do diagonal (up right + up left keys).. This is what I would like to implement. Have you tried it?
All help / hints appreciated
barefoot
You can store data in external files. Just look up File.Open/Close and File.ReadInt/WriteInt.
Cheers Khris
I'll read up about it.
:=
barefoot
Quote from: barefoot on Sat 11/06/2011 21:18:46
MODULE: KeyboardMovement v1.02: have heard you can do diagonal (up right + up left keys).. This is what I would like to implement. Have you tried it?
Of course diagonal walking works, you don't need to implement anything.
Cheers Matti
I'll give it a whirl
:=
barefoot
Function Declaration:
enum Score {
Get,
Set,
Reset
};
import function HighScore(Score param, int hscore=-1);
Function
function HighScore(Score param, int hscore)
{
if (param==Reset)
{
File.Delete("highscore.txt");
}
if (param==Get)
{
File *input = File.Open("highscore.txt", eFileRead);
if (input != null)
{
hscore = input.ReadInt();
input.Close();
Display("hscore is %d",hscore);
return hscore;
}
}
if (param==Set)
{
File *output = File.Open("highscore.txt", eFileWrite);
if (output == null)
{
Display("Error opening file.");
}
else
{
output.WriteInt(hscore);
output.Close();
}
}
}
How to Use?
HighScore(Set,200); //This will set the highscore to 200.
HighScore(Get); //This will get the current highscore.
HighScore(Reset); //This will reset the highscore.
Now if you want multiple highscores, I apologize, and I'll fix.
Isn't there a module that does this? I think Rocco made one..pretty sure..coz I seem to recall commenting on my own unreleased module for the same thing.
I mean, doing it yourself is fine too, but there's no need to reinvent the wheel unless you (like me :P) just really, really enjoy doing so. :=
Edit: Apparently I didn't actually comment in the module's thread, the latest version of AGS that it's been verified to work with is 3.0.1, and without having used it I'm not sure how easy/difficult it might be to customize it to work with your own game (seems like it might be a rather basic module with little-to-no customization options)..but:
Rocco's Highscore Module (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=34233.0)
Quote from: monkey_05_06 on Sun 12/06/2011 22:51:42
Isn't there a module that does this? I think Rocco made one..pretty sure..coz I seem to recall commenting on my own unreleased module for the same thing.
I mean, doing it yourself is fine too, but there's no need to reinvent the wheel unless you (like me :P) just really, really enjoy doing so. :=
It was fun and it took me like 10 minutes :P
Can't a man have fun?!
I knew there's a highscore module, I recall someone even used it along with encrypted module or something, that you coded.
I have a feeling that there are more than one highscore modules though, but it may be just me.
Quote from: DualnamE3 on Sun 12/06/2011 23:06:22Can't a man have fun?!
No! Don't you remember the quiz you took all those years ago when signing up for the forums? Having fun is against the forum rules. 8)