Activity: Add Click
I'M FINISHED WITH HOUR OF CODE!

STEP 8: Let’s start to add the ability to make a basketball once the user clicks on your sprite.

An event is a block of code that runs when something happens—like when someone clicks on a sprite.

  • Click on in the toolkit.
  • Drag out Sprite Click and drop it at the bottom of your program.
  • Run your program and click on the sprite. You should see it say "Hello, name".

stage.set_background("halfcourt") sprite = codesters.Sprite("player1") sprite.go_to(-175, -150) net = codesters.Sprite("basketballnet") net.go_to(215, 175) stage.set_gravity(10) sprite.set_gravity_off()
Support