第 9 步:现在我们可以使用存储在head_image中的值来显示我们混合角色的头部!

  • 在图形中,从将一个Sprite at Position拖到程序的底部。
  • 将变量名从sprite更改为head
  • 将图像标签从"codester"更改为head_image
  • 将 y 坐标更改为83 。请注意,每次你得到一个不同的头运行你的程序!

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
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)