El jugador también va a ser capaz de mover el balón hacía abajo.

  • Ve a en el kit de herramientas y arrastra Down Key a la parte inferior de tu programa.
  • Cambia el número adentro del comando .move_down() a 10.
  • Cambia el nombre en el comando .move_down() a ball.
  • Haz clic en Correr y pulsa las teclas de flechas izquierda y hacía abajo para probar tu programa.

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) ball.set_gravity_off() net.set_gravity_off() left_count = 0 down_count = 0 def left_key(): ball.move_left(10) # add other actions... global left_count left_count += 1 stage.event_key("left", left_key)