Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Game reset

    Beginners
    4
    5
    314
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • AndyG1985
      AndyG1985 last edited by

      This seems like the kind of thing that may have been asked already, but I can't find any mention.
      Is there a command for resetting your game? For example, when the player has died?

      pianofire 1 Reply Last reply Reply Quote 0
      • pianofire
        pianofire Fuze Team @AndyG1985 last edited by

        @AndyG1985 No I'm afraid you have to do that yourself. Create a function called reset and set your variables back to the initial values.

        1 Reply Last reply Reply Quote 3
        • pobtastic
          pobtastic F last edited by pobtastic

          Here's a pattern I often use;

          loop
          
            if !game.active then
              show_splash()
            endIf
          
            initialise_variables()
          
            while game.active loop
              game_loop()
            repeat
          
            // If lives aren't zero then the game was quit prematurely.
            if game.lives == 0 then
              game_over()
            endIf
          
          repeat
          

          If you bail out of game_loop() without setting game.active to FALSE then it'll reinitialise a new "level" from scratch (or a brand new game if you don't loop around game_loop()). Obviously too, this allows for a "quit game" and game_over() call depending on how the game ends.

          1 Reply Last reply Reply Quote 5
          • AndyG1985
            AndyG1985 last edited by

            Thanks a lot, I'll have a think about this for my game :)

            waldron 1 Reply Last reply Reply Quote 0
            • waldron
              waldron F @AndyG1985 last edited by

              @AndyG1985 Dave's sample program the ninja one is a good guide for this

              1 Reply Last reply Reply Quote 1
              • First post
                Last post