STEP 2: Now let's add some action to our scene!

All commands that should run when the function is called must go INSIDE the function.

  • Have the sprite Say "I should hurry to the castle!". Make sure it goes inside the function!

  • Have the sprite Move Forward 550 pixels so that it will move off the stage when we call this function.

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")
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)