انتقل للمحتوى
Robo EgyptRobo Egypt
☰ Course contents

Sprites and movement: the bouncing ball

Section 9: GamesLesson 9.2 · ⏱ 12 min
Every 0.03 seconds the ball moves, and at the edge its speed turns round. Tapping the ball adds points and makes it faster
Every 0.03 seconds the ball moves, and at the edge its speed turns round. Tapping the ball adds points and makes it faster
The ball bounces, and we tapped it three times
The ball bounces, and we tapped it three times
  • 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.

The design
The design
The blocks
The blocks
In the lab: the ball is moving
In the lab: the ball is moving
✍️ Practise
Make the example yourself: put the parts in “🎨 Design”, then the blocks, and tap ▶ Run.
✍️ Practise here in the lessonor open the lab in a new page ↗

🎯 Challenge yourself

Easy

The ball goes down.

👀 Show the solution
The design
The design
The blocks
The blocks
In the lab
In the lab

Result: the ball went down.

Medium

At the bottom edge the ball goes back to the top.

👀 Show the solution
The design
The design
The blocks
The blocks
In the lab
In the lab

Result: it goes down and comes back.

Hard

Every tap on the ball adds points.

👀 Show the solution
The design
The design
The blocks
The blocks
In the lab
In the lab

Result: 3 points.

Finished the lesson? Mark it so your progress counts.