STEP 11: Let's now make our soccer ball bounce around!

The x speed of a sprite is how fast it moves horizontally. The y speed of a sprite is how fast it moves vertically.

  • In the toolkit, click on and drag in Set x Speed to the bottom of your code editor.
  • Click Run. You should see your soccer player bounce horizontally back and forth.

To navigate the page using the TAB key, first press ESC to exit the code editor.

microbit = codesters.Microbit() microbit.show_string("hello") stage.set_background("soccerfield") sprite = codesters.Sprite("athlete2") sprite.move_down(150) def button_a(): sprite.move_left(50) microbit.event_button_a(button_a) def button_b(): sprite.move_right(50) microbit.event_button_b(button_b) ball = codesters.Sprite("soccerball")
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)