PDA

View Full Version : DelphiX -- Saving top scores



Wizard
11-01-2007, 09:53 AM
Hi guys, I've created a startfighter game and my player scores points for all the alienships destroyed etc.

I would like to have a form/box where, if a player scores more than 500 000 points, he can type his name as a top score and the scores will then be saved.

Can anyone please help me/provide a link for a tutorial?

Thanks :-)

Paizo
11-01-2007, 10:17 AM
for example:





if InputQuery('you made 9999999 points!!!', 'enter your name', TmpStr) then
begin
name := TmpStr;
end;

Traveler
11-01-2007, 10:24 AM
I assume you have something done with gamestates

in your main loop

case gamestate of:
gsMenu : displayMenu();
gsOptions : displayOptions():
gsGame : runGame();
gsGameOver : displayGameOverAnimation();
gsDisplayScoreList: displayScoreList();
gsEnterHighScore : displayHighScoreForm();
gsExit : cleanEveryThingUpAndThenExitGame();
end;

Now when the player has a sufficient score you can either send him to gsDisplayScore, gsEnterHighScore or gsMenu.




function getLowestScoreFromList():word;
begin
// get the lowest value from thescoreList,
end;


procedure TPlayer.Collsion;
begin
(...)

if (player.lives <= 0) then
begin
player.dead := true;
if (player.score = 0) then gamestate := displayGameOverAnimation
else (if player.score < getLowestScoreFromList() ) then displayScoreList()
else (if player.score > getLowestScoreFromList() ) then displayHighScoreForm()
end
else dec(player.lives)
end;



I hope this helps a bit...

Paizo
11-01-2007, 10:33 AM
and:
if player.score = getLowestScoreFromList&#40;&#41;? :lol:
i'm joking :P

i think you should write instead:

if &#40;player.lives < 1&#41; then
begin
player.dead &#58;= true;
if player.score <= getLowestScoreFromList&#40;&#41; &#41; then displayScoreList&#40;&#41;
else displayHighScoreForm&#40;&#41;
end
else dec&#40;player.lives&#41;

and show displayGameOverAnimation after

Wizard
11-01-2007, 12:50 PM
Thanks, I'll try it out :-)

WILL
11-01-2007, 03:40 PM
How does DelphiX have anything to do with Saving Scores?

chronozphere
11-01-2007, 05:49 PM
As far as i know... nothing :) You always have to implement it yourself.
I don't know any game-engines/libraries which do this for you. :?

WILL
11-01-2007, 06:17 PM
Hmm.. ok it seems that I may have misread the thread.

Still though, I'm not sure how DelphiX related this topic is. :? Maybe I've just became unfamiliar with the functionality of it since ages ago.

Wizard
11-01-2007, 06:23 PM
How does DelphiX have anything to do with Saving Scores?

O, chill out WILL...not everything is etched in black & white. Am I once again in the wrong forum??? :-()

Not to worry -- I learned something at least. I wasn't even aware that there's a call to InputQuery. :-) :-) :-)

Chesso
12-01-2007, 08:50 AM
Yeah basically using gamestates, you make one for the highscores display.

Heck you can slap real controls on top of the form itself and just have them hidden and disabled until you need them.