PASO 12: ¡Configuremos los controles del jugador! Clic en la pestaña GRAPHICS para encontrar eventos.

  • Ve a la sección del kit de herramientas y arrastra Left Key al final de tu programa.
  • Cambia el número en el comando .move_left() a 10.
  • Cambia el nombre en el comando .move_left() a ball.

Events permiten dar una señal (como pulsar una tecla) que provoca una acción (mover el balón a la izquierda).

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) ball.set_gravity_off() net.set_gravity_off() left_count = 0 down_count = 0
  • Run Code
  • Enviar Trabajo
  • Actividad Siguiente
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)