STEP 10: Time to end our story with one final scene!

  • Drag one more Define Function to the bottom of your program. Name it reward_scene.
  • Drop the Castle and Wizard INSIDE your function. Change the name of the sprite to wizard.
  • Position the wizard at -150, -150 and have the wizard say "You defeated the dragon!"
  • Drop a Wait command at the bottom of your function.

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!") sprite.move_forward(300) dragon.turn_left(360) dragon.move_down(200) sprite.say("The path is clear!") battle_scene()