Activity: Disable Right Wall
I'M FINISHED WITH HOUR OF CODE!

STEP 13: It's weird that the ball bounces around the stage if we miss the basket. Let's change that!

The Codesters stage has a floor, walls, and ceiling. When they're disabled, object won't bounce off them.

  • In , drag in Disable Right Wall to the bottom of our program. It should NOT be indented!
  • If the player misses the basket, this stops the ball from bouncing off the right wall.
  • Click Run to play. Click Submit and Next to move on and customize your program.

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) ball.set_y_speed(10) # add other actions... sprite.event_click(click)
Support