Make something happen when two sprites touch, and use kinds to decide which event runs.
Pac-Man eats a dot, Mario grabs a coin, a ghost catches you: every game is full of things touching, and each touch means something different.
Last lesson sprites moved, but flew straight through each other. Now they notice. When two sprites touch, they overlap, and an on overlap event (in Sprites › Overlaps) can run.
Every sprite has a kind: Player, Food, Enemy or Projectile. Until now every sprite said of kind Player. This lesson the kind matters: it is how the game tells a coin from a monster.
Click the simulator, then steer with the arrow keys.
Make your prediction first. Help opens once you've locked it in.

let mySprite = sprites.create(img`
. 4 4 .
4 4 4 4
. 8 8 .
. 8 8 .
`, SpriteKind.Player)
controller.moveSprite(mySprite)
let coin = sprites.create(img`
. 5 5 .
5 5 4 5
5 4 5 5
. 5 5 .
`, SpriteKind.Food)
coin.setPosition(120, 60)
sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
otherSprite.destroy()
info.changeScoreBy(1)
})
The coin is made of kind Food. Look at the two kinds named in the on overlap block.
Steer onto the coin. Watch the top of the screen.

let mySprite = sprites.create(img`
. 4 4 .
4 4 4 4
. 8 8 .
. 8 8 .
`, SpriteKind.Player)
controller.moveSprite(mySprite)
let coin = sprites.create(img`
. 5 5 .
5 5 4 5
5 4 5 5
. 5 5 .
`, SpriteKind.Food)
coin.setPosition(120, 60)
sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
otherSprite.destroy()
info.changeScoreBy(1)
})
Collect the coin, then touch the spike.

info.setScore(0)
let mySprite = sprites.create(img`
. 4 4 .
4 4 4 4
. 8 8 .
. 8 8 .
`, SpriteKind.Player)
controller.moveSprite(mySprite)
let coin = sprites.create(img`
. 5 5 .
5 5 4 5
5 4 5 5
. 5 5 .
`, SpriteKind.Food)
coin.setPosition(120, 60)
let spike = sprites.create(img`
. f . f
f 2 f .
. f 2 f
f . f .
`, SpriteKind.Enemy)
spike.setPosition(40, 30)
sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) {
info.changeScoreBy(1)
otherSprite.destroy()
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Enemy, function (sprite, otherSprite) {
info.changeScoreBy(-1)
otherSprite.destroy()
})
Ava's overlap event is the same as this game's. She made her star like this:

let star = sprites.create(img`
. 5 .
5 5 5
. 5 .
`, SpriteKind.Player)
Match what touches with what happens in this game.
Make each coin worth 5 points.
Change the 1 in change score by 1.
Add a second coin, of kind Food, somewhere else on the screen. Does it need its own overlap event?
Drag in another set … to sprite of kind block, and choose Food as its kind.
Give it its own name and its own set position. You do not need a new overlap event.
Make each coin worth 5 points.
This ticks by itself when your blocks do what is asked.
Add a second coin of kind Food somewhere else. Collect both.
This ticks by itself when your blocks do what is asked.

let ship = sprites.create(img`
. . 1 . .
. 1 1 1 .
1 1 1 1 1
`, SpriteKind.Player)
ship.setPosition(80, 105)
controller.moveSprite(ship, 100, 0)
Make a collector game:
Check every create block: is its kind right?
Two new sprites: one of kind Food, one of kind Enemy. Click the kind in each create block.
Two on overlap blocks (Sprites › Overlaps): Player with Food, and Player with Enemy.
Food: change score by 1, then destroy otherSprite. Enemy: change score by -1, then destroy otherSprite.
A collector: touching Food scores 1 and removes it; touching an Enemy takes 1 away.
This ticks by itself when your blocks do what is asked.
Bananas fall into a basket at a market stall. Make them fall faster, then add a rotten tomato of kind Enemy that falls too and takes 2 points when caught.
Students make overlap events that run when two sprites touch, and see that the kinds named in the event decide which event runs. About 40 minutes.
Open the teacher guide: answers, solutions, slides and a worksheet.
An overlap is two sprites touching. on sprite of kind Player overlaps otherSprite of kind Food (Sprites › Overlaps) is an event: it runs when a sprite of the first kind touches a sprite of the second kind, and never for any other pair. Inside it, sprite is the first one (the player) and otherSprite the second (the coin that was touched). Every sprite has a kind: Player, Food, Enemy or Projectile. The create block starts with of kind Player, so a forgotten kind is the most common bug: a coin made as a Player is never collected. change score by (Info) shows a score at the top of the screen.
Kinds decide which overlap runs, and sprite versus otherSprite. When a touch does nothing, ask them to read out the kinds of both sprites and the kinds the event names.
Stretch: Add a second kind of good food worth 3 points. Which kinds does its event need?
Support: Give students the Food and Enemy sprites already made with the right kinds, and ask them to build only the two overlap events.
Next lesson adds lives and a game that ends. Class ideas: a recycling sorter (paper is Food, plastic is Enemy); design a game where the kinds are swapped: what changes?