STEP 14: We're getting there! Now that our soccer ball is moving, we need to make it bounce off the player's head.

A collision event lets the computer know what to do when two sprites collide.

  • Click on GRAPHICS and then click on .
  • Drag in Collision to the bottom of your code editor, and then press Run.
  • What happens when your sprites collide? Click Submit and Next after running the program a few times.

Not started reading
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") ball.set_x_speed(5) ball.set_y_speed(5)
Not started