Activity: Place Ball
I'M FINISHED WITH HOUR OF CODE!

STEP 10: Let's move our basketball, so when click on our player, it appears near our player.

In Python, indents are important! If your code isn't indented correctly, then you'll get an error!

  • Go to the section of the toolkit and drag Go To into your program INSIDE your click event.
  • Change the first number in the .go_to() command to -175 and change the second number to -125.
  • Change the name in front of the .go_to() command to ball.

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() def click(sprite): ball = codesters.Sprite("basketball") # add other actions... sprite.event_click(click)
Support