Avatar

Avatar
MrsAnderson

Tuesday 2 February 2016

7waIS2 Sratch 4 - Variables

LO To understand the concept of variables
Create and program variables using Scratch


Starter - what  does 'vary' mean?  What is a 'variable' in a game?  How could you use a variable in your game?  

A variable in Scratch Programming is something that can change - ie:  score, lives, health bar. Today you're going to create a Score.  Read and following the instructions very carefully.



Task 1: Creating a Variable

a) Open your Scratch game from your Sites folder and create a 'score' variable.  You'll need to find the Orange Variable icon.  Yours could say DATA instead of Variable, so check carefully.
Follow this diagram












Task 2: Enemy Score

a) Add script to your main character/ goody that sets the score to '0' when the game starts







b) Add script to your 'enemy  /baddy ' that will decrease the score by 10 points (-10) when you hit it










Task 3: Collecting Points

a) Load or create a sprite to act as way to collect points (coin, heart, jewel etc.)

b) Add script to your 'good item' that will increase the score by 10 points


EXTENSION: 

Try adding a life or health variable into the game - what impact does this have? 

No comments:

Post a Comment