EXTEND—STEP 1: Let's make our game harder by speeding up the ball every time it bounces off the athlete's head!

  • Inside your collision event, DELETE this line: hit_sprite.set_y_speed(5)
  • In , drag in Get y Speed inside your collision event. This gives us the ball's current speed.
  • Change the name in front of .get_y_speed() from sprite to hit_sprite.
  • Make sure your .get_y_speed() line is indented four spaces. It should have this in front: ····

Not started reading
microbit = codesters.Microbit() microbit.show_string("hello") stage.set_background("moon") sprite = codesters.Sprite("astronaut1") 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("rock") 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) stage.disable_floor()
Not started