Results 1 to 10 of 10

Thread: DelphiX -- Saving top scores

  1. #1

    DelphiX -- Saving top scores

    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 :-)
    Wake up from the dream and live your life to the full

  2. #2

    DelphiX -- Saving top scores

    for example:



    Code:
      if InputQuery('you made 9999999 points!!!', 'enter your name', TmpStr) then
       begin
        name := TmpStr;
      end;
    Will: "Before you learn how to cook a fish you must first learn how to catch a fish." coolest

  3. #3

    DelphiX -- Saving top scores

    I assume you have something done with gamestates

    in your main loop

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

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


    [pascal]

    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;

    [/pascal]

    I hope this helps a bit...

  4. #4

    DelphiX -- Saving top scores

    and:
    Code:
    if player.score = getLowestScoreFromList&#40;&#41;
    ? :lol:
    i'm joking

    i think you should write instead:
    Code:
        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
    Will: &quot;Before you learn how to cook a fish you must first learn how to catch a fish.&quot; coolest

  5. #5

    DelphiX -- Saving top scores

    Thanks, I'll try it out :-)
    Wake up from the dream and live your life to the full

  6. #6
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    DelphiX -- Saving top scores

    How does DelphiX have anything to do with Saving Scores?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  7. #7

    DelphiX -- Saving top scores

    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. :?
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  8. #8
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    DelphiX -- Saving top scores

    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.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  9. #9

    DelphiX -- Saving top scores

    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. :-) :-) :-)
    Wake up from the dream and live your life to the full

  10. #10

    DelphiX -- Saving top scores

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •