PASO 9: ¡Ahora podemos usar el valor almacenado en head_image para mostrar la cabeza de nuestro personaje mezclado!

  • En GRÁFICOS, de arrastre un Sprite at Position hasta la parte inferior de su programa.
  • Cambia el nombre de la variable de sprite a head .
  • Cambie la etiqueta de la imagen de "codester" a head_image .
  • Cambie la coordenada y a 83 . Observe que obtiene una cabeza diferente cada vez que ¡ Ejecuta tu programa!

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

######################################################################## # PLACE LIST CREATIONS HERE # ######################################################################## stage_list = ["moon", "mars", "jupiter", "pluto", "space", "city"] head_list = ["head1", "head2", "head3", "head4", "head5", "head6"] ######################################################################## # PLACE ALL OTHER CODE BELOW THIS # ######################################################################## stage_image = stage_list[1] stage.set_background(stage_image) random_head = random.randint(0, 5) head_image = head_list[random_head]
  • Run Code
  • Enviar Trabajo
  • Actividad Siguiente
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)