STEP 18: We're done! Let's just have a consequence for when the player misses the ball.

The Codesters stage has a floor, walls, and ceiling. When they're disabled, object won't bounce off them.

  • In , drag in Disable Floor to the bottom of your program. This shouldn't be indented.
  • This turns the floor "off." This means our ball will pass through it if the player misses.
  • Click Run and play your completed game!

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) def collision(sprite, hit_sprite): hit_sprite.set_y_speed(5) sprite.event_collision(collision)