We don't want the gravity to affect any of our sprites yet.

  • From the section of the toolkit, drag Sprite Gravity off into your program.
  • Assign the command to ball by changing the name before .set_gravity_off() to ball.
  • From the , drag another Sprite Gravity off into your program. Assign it to net.
  • Click Run to test your program. Now our sprites don't fall.

To navigate the page using the TAB key, first press ESC to exit the code editor.

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") x = random.randint(-100, 150) ball.go_to(x, -25) stage.set_gravity(10) stage.set_bounce(.8)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)