STEP 7: Let's have the ball go to a random position on the stage.

  • Click on the LOGIC tab. Then, go to and drag Random Integer into your program.
  • Change the variable name (before the equals sign) to x.
  • Change the numbers to (-100, 150).

This command picks a random x-value between -100 and 150. The coordinate is stored in the variable named x.

stage.set_background("halfcourt") sprite = codesters.Sprite("player4") sprite.go_to(215, -175) net = codesters.Sprite("basketballnet") net.go_to(215, 175) ball = codesters.Sprite("basketball")