The game canvas: paint with your finger
Section 9: GamesLesson 9.1 · ⏱ 10 min


- A canvas is a space you draw on and put sprites in.
- touch x and touch y are where the finger is on the canvas.
- The 🧽 button clears the whole drawing.
- Add a green button.
- Make a button that makes the brush bigger (a variable for the size).
📌 Another example: a brush with three sizes
Buttons change the brush size, and we draw with the finger.



✍️ Practise
Make the example yourself: put the parts in “🎨 Design”, then the blocks, and tap ▶ Run.
✍️ Practise here in the lesson✖ Close the labor open the lab in a new page ↗
🎯 Challenge yourself
Easy
Draw in green.
👀 Show the solution🙈 Hide the solution



Result: a green line.
Medium
A tap on the canvas draws a big circle there.
👀 Show the solution🙈 Hide the solution



Result: a red circle.
Hard
A “Clear” button clears the canvas.
👀 Show the solution🙈 Hide the solution



Result: the canvas is empty.

