Create a Chase Game with Keyboard Controls
Use the Canvas Component for Game Animation
How to create Procedures to simplify your code
How to create unique Sprites and Sprite Types
How to position sprites on Thunkable Canvas Coordinate Grid
Procedures: A named piece of code that can be called over and over; also known as a Function
Sprite Type: A Category of Sprites that you can add to an app
Sprite: A single instance of a Sprite Type
Add a Timer and a Label that Counts down from 20. The game should play a sound when the countdown reaches 0.
Blocks
Create New Variable: “Time”
Initialize variable to 20
When Timer Fires
If Time = 0
From Sound1 set source to game_over.wav
play Sound1
Set Timer Enable to False
Else
Set Time Variable to Time minus One
Set Timer Label to new value
*Add to When Start button clicked,
set Timer Enabled to True
Have the Villain move randomly.
When Mario touches the Villain, have him lose points and shrink
Design
Add a new Timer Component: Timer2
Set interval to 3 seconds
Set Loops to True
Add a new Sprite Type and change the picture to Bowser
Rename “Bowser”
Drag a Bowser Sprite onto the Canvas
Blocks
Create new Procedure: “Shrink”
Drag out a ”to do something” block from Function drawer
Rename “Shrink”
Set Mario’s height to Mario’s height - 10
Set Mario’s width to Mario’s width - 10
When Timer2 Fires
Set Bowser X to random integer from 1 to 300
Set Bowser Y to random integer from 1 to 300
**Add to When the Timer1 Fires Event
If app variable time = 0
Set Timer2 enabled to False
**Add to When StartButton Clicked
Set Timer2 enabled to True
When Mario collides Bowser,
Change app Score by -1
From Score Label set text to Score Variable
From Sound1 set source to touch_enemy.wav
Play sound
Shrink Procedure
Design
Add a new Screen
Add a Label with text “Game Over”
Add a Button “New Game”
Blocks
*Add to When the Timer fires
From sound1 set source to game_over.wav
Play sound
Set Timer Enable to False
Navigate to GameOverScreen
When New Game Button clicked
Navigate to Screen 1