Home‎ > ‎

Game Buttons

These are buttons that every game usually has. Maybe not all of these buttons, but most of them
  • Start 
  • Stop 
  • Pause 
  • Reset

Adding START and STOP buttons, and being able to stop the objects from popping up

If you want to make it nice, add a global variable to tell whether the game is stopped or not and buttons to start and stop the game. That way, you can check if the game is over and stop moving the object

    Add on the card script:

        global gameRunning
    
    Add a "Start" button with this script:

        on mouseUp
            put true into gameRunning
        end mouseUp


    Add a "Stop" button with this script:

        on mouseUp
            put false into gameRunning
        end mouseUp


The true/false variable - gameRunning - is necessary because the "game loop" uses it to stop background motion - like the Terrain moving, enemies attacking, objects flying by, the timer going, etc. 

The Start button also may do other things like 
  • reset the score to zero
  • reset the timer to it's start value
  • move the player back to the start position
  • reset the visible/invisible objects
  • and lots of other things that you have in your game
If you have the Start button just stop the action, then you need a Reset button to do a lot of the resets that are listed in the Start button above

The Pause button is just for stopping the action and does not reset anything

Comments