Sensing and Variables
description
Transcript of Sensing and Variables
![Page 1: Sensing and Variables](https://reader036.fdocuments.in/reader036/viewer/2022062501/56815b62550346895dc94c33/html5/thumbnails/1.jpg)
Game Control
Sensing and Variables
![Page 2: Sensing and Variables](https://reader036.fdocuments.in/reader036/viewer/2022062501/56815b62550346895dc94c33/html5/thumbnails/2.jpg)
Game Control
Learning Objective
• “Learn how to sense events and keep score”.
• Write this Learning Objective onto Page 1 of your workbook.
Saturday 22 April 2023
![Page 3: Sensing and Variables](https://reader036.fdocuments.in/reader036/viewer/2022062501/56815b62550346895dc94c33/html5/thumbnails/3.jpg)
Game Control LO
Sensing• Sensing can be used to detect when
something has happened in a game. Like touch in this example:
Learn how to sense events and keep score.
Add to score.
Is shark touching fish?
Yes
No
![Page 4: Sensing and Variables](https://reader036.fdocuments.in/reader036/viewer/2022062501/56815b62550346895dc94c33/html5/thumbnails/4.jpg)
Game Control LO
Variables
• Variables are used to store data.
• In order for a game to “remember” what a players score is it must store it in a variable.
Learn how to sense events and keep score
LIFESCOREPLAYER NAMES
Think of variables as boxes to store data which can be
retrieved later.
![Page 5: Sensing and Variables](https://reader036.fdocuments.in/reader036/viewer/2022062501/56815b62550346895dc94c33/html5/thumbnails/5.jpg)
Game Control LO
The Game• Use the instructions on page 10 of your
workbooks to create this Shark Attack game:
Learn how to sense events and keep score
Shark will move up and down using cursor keys.
Score shown here.
Fish will start in a different
place each time.
![Page 6: Sensing and Variables](https://reader036.fdocuments.in/reader036/viewer/2022062501/56815b62550346895dc94c33/html5/thumbnails/6.jpg)
Game Control LO
Extension Task
• Make your game better by adding some more features:– Change the sharks costume so it closes
it’s mouth to eat the fish.– Add a GAME OVER stage to be displayed
if the fish doesn’t get eaten.
Learn how to sense events and keep score
![Page 7: Sensing and Variables](https://reader036.fdocuments.in/reader036/viewer/2022062501/56815b62550346895dc94c33/html5/thumbnails/7.jpg)
Game Control
Learning Objective
• “Learn how to sense events and keep score”.
• Put or onto your Self Assessment page to show whether or not you have achieved today’s learning objective.
Saturday 22 April 2023
![Page 8: Sensing and Variables](https://reader036.fdocuments.in/reader036/viewer/2022062501/56815b62550346895dc94c33/html5/thumbnails/8.jpg)
Game Control LO
What can you remember?
• What do X and Y mean when talking about the position of a sprite?
• What is a variable used for?
• What does broadcast mean?
Learn how to sense events and keep score