第 8 步:现在我们需要使用索引来获取角色头部的图像标签!

  • 并将另一个Get Value at Index拖到程序底部。
  • 变量名my_var更改为head_image
  • 列表名称my_list更改为head_list
  • 将括号中的索引从0更改为random_head 。索引现在是从 0 到 5 的随机数!

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