Activity: Set y Speed
I'M FINISHED WITH HOUR OF CODE!

STEP 12: We're almost to the basket! Let's give our ball a bit more of a boost to get there.

  • In , drag Set y Speed INSIDE your click event. It should be indented 4 spaces.
  • Change the name in front of .set_y_speed() from sprite to ball.
  • Finally, change the number inside the parentheses from 5 to 10.

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") ball.go_to(-175, -125) ball.set_x_speed(10) # add other actions... sprite.event_click(click)
Support