第 13 步:现在我们可以使用存储在body_image中的值来显示我们混合角色的身体!

  • 在图形中,从将一个Sprite at Position拖到程序的底部。
  • 通过将变量名从sprite更改为body body
  • 将图像标签从"codester"更改为body_image
  • 请注意,每次您获得不同的头部和身体运行你的程序!

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"] body_list = ["middle1", "middle2", "middle3", "middle4", "middle5", "middle6"] ######################################################################## # 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] # sprite = codesters.Sprite("image", x, y) head = codesters.Sprite(head_image, 0, 83) random_body = random.randint(0, 5) body_image = body_list[random_body]
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)