STEP 9: Our sprite can only move left. What about the B button?

An event is a block of code that runs when something happens—like when someone presses a button.

  • In SUBJECT, click on . Then, drag in the block B Button Press to the bottom of your editor.
  • Click Run and press B on your micro:bit. Your sprite should move right.

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)
Not started