Activity: Space Bar
I'M FINISHED WITH HOUR OF CODE!

STEP 14: Let's make our asteroid fly around the stage when we hit the space bar!

  • Go to and drag Space Bar to the bottom of your program.

This event makes the sprite jump when the space bar is pressed. In the next activity, we'll customize the event by adding our own commands.

stage.set_background("moon") sprite = codesters.Sprite("astronaut1") sprite.go_to(-125, -150) glorp = codesters.Sprite("alien1") glorp.go_to(100, -125) rock = codesters.Sprite("asteroid") rock.go_to(100, 75) sprite.say("What do planets read?") sprite.set_say_color("white") def click(sprite): sprite.say("Comet books!") sprite.turn_left(360) # add other actions... sprite.event_click(click)
Support