Archive for the ‘Scratch’ category
My demo game for today in Scratch involves checking to see if a button is pressed, changing a variable and a costume if it’s pressed, and then checking if the required score has been met.
The variable is boot to the head. *
When the green flag is clicked to start the game, we reset boot to the head and the costume to give the player a fresh start.
Next, we check to see if the spacebar has been pressed. If it has, we change boot to the head by one and do a mini-animation of a cat with a boot to the head. I put a wait command in there so the user’s eye can actually see the costume change.
We use an “if…” statement (found in the Control section) and use an operator (the green section) to see if boot to the head equals 10, our designated end of the game. If the player has 10 boot to the heads (boots to the head?), we reward them with a positive message of encouragement and then cruelly reset the score.
This is my demo, but I know that you’ll need variables to keep track of info in your games for the competition. Use the same techniques for your own variables.
One of the things you usually need in a video game is the ability to change what the background looks like. First, you’ll need to create the backgrounds in Scratch:
I’ve created two backgrounds using the built-in paint editor. They’re very intricate backgrounds named “background1″ and “background2″. You can name yours differently, just remember what you called them.
- Reset the background to background1 at the start.
- Broadcast either a Go to 1 or Go to 2, depending on what key is pressed.
- The script checks what’s broadcast and changes the level’s appearance.