由于我们存储了用户在变量中输入的内容,所以我们可以使用该变量在故事中显示用户的答案。

  • 点击 。将 Set Text 拖动到代码底端。将其前面的名称更改为 text
  • 将括号内的字符串更改为变量 transition1。一定要删除引号!

.set_text() 指令将替换当前文本框中的内容。

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

stage.set_background("park") sprite = codesters.Sprite("person3") sprite.glide_to(-100, 50) # text = codesters.Text("text", x, y, "color") text = codesters.Text("I went to the park!", 0, -200, "blue") stage.wait(1) sprite.move_right(400) transition1 = sprite.ask("Choose a transition from the sequence category.")
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)