第8步:让我们打败龙!

  • 点击 。使用 .move().turn() 指令开始你的战斗。
  • 尝试让骑士去攻击龙,然后让龙从桥上掉下来。
  • 发挥创意,添加一些跳跃和转弯,使战斗更加复杂。
  • 战斗结束后,使用 Say 让骑士宣布 "The path is clear!"

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

sprite = codesters.Sprite("knight1", -175, -150) sprite.set_speed(2) def park_scene(): stage.set_background("park") sprite.say("I should hurry to the castle!") sprite.move_forward(550) park_scene() def bridge_scene(): stage.set_background("drawbridge") sprite.go_to(-175, -150) sprite.say("I made it!") stage.wait(2) bridge_scene() def battle_scene(): dragon = codesters.Sprite("dragon", 150, -150) sprite.say("Oh no a dragon!")
  • Run Code
  • 提交作品
  • 下个活动
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)