y8 lesson 5
Learning objective
y8 lesson 5
Learning objective
Lesson objective
To use collision events and functions to create a game in MakeCode Arcade.
In programming, what is an event?
A mistake in the code that stops the program working
A set of instructions that triggers when something happens
A variable that stores the player’s score
A sprite that appears on the screen
Collision events/ Overlap events
A collision event happens when two sprites touch.
In MakeCode Arcade, this is also called an overlap event.
This event runs only when a sprite of kind "Player" touches a sprite of kind "Enemy"
MakeCode Arcade’s overlap event detects when sprites of specified kinds overlap, and the event gives access to the first sprite as sprite and the second as otherSprite.
Collision examples
Item Collection: A character touching a coin, potion, or key triggers the item to be removed from the scene and added to the inventory.
Combat Interactions: An arrow striking an enemy, a sword colliding with a shield, or a bullet hitting a player.
Environmental Obstacles: A player character walking into a wall, locked door or obstacle.
Trigger Zones: Crossing a boundary, such as entering a new room, triggering a cutscene, or activating a trap.
Physics Response: A ball bouncing off a paddle in a breakout game, or cars colliding in a racing game.
What other examples of collision/overlap events from games you have played can you think of?
Which of these is NOT an example of a collision/overlap event in a game?
A laser hits an enemy
A player touches a coin
An enemy touches the player
The player presses the A button
MakeCode Arcade
Makecode arcade