PASO 12: La nave y el asteroide tienen el mismo nombre. Cambiemos el nombre del asteroide para que no se confundan.

  • Encuentra el asteroide en tu código.
  • Cambia la palabra antes del signo igual = a top_rock.

El nombre de una figura es la palabra naranja antes del signo igual y es usado para dar comandos a ésta.

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

stage.set_background("space") sprite = codesters.Sprite("spaceship") sprite.set_size(0.5) sprite.go_to(-200, 0) stage.set_gravity(10) stage.disable_all_walls() def space_bar(): sprite.jump(5) # add other actions... stage.event_key("space", space_bar) def interval(): top_height = random.randint(1,10) # sprite = codesters.Sprite("image", x, y) sprite = codesters.Sprite("asteroid", 0, 0) # add any other actions... stage.event_interval(interval, 2)
  • Run Code
  • Enviar Trabajo
  • Actividad Siguiente
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)