Sprites and movement: the bouncing ball
Section 9: GamesLesson 9.2 · ⏱ 12 min


- A sprite is a picture that moves inside the canvas.
- change Sprite1 x by … y by … moves it one step.
- at edge asks: did it reach the edge? Then we turn the speed round:
0 − speedX. - speedX × 1.1 adds 10% to the speed with every point.
📌 Another example: the ball bounces off the sides
The ball moves right and left, and at the edge it turns back.



✍️ 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
The ball goes down.
👀 Show the solution🙈 Hide the solution



Result: the ball went down.
Medium
At the bottom edge the ball goes back to the top.
👀 Show the solution🙈 Hide the solution



Result: it goes down and comes back.
Hard
Every tap on the ball adds points.
👀 Show the solution🙈 Hide the solution



Result: 3 points.

