Unit 3 · Lesson 3

Test and share Crystal Trail

  • Areas, progress and saving
  • 60 minutes
  • Advanced Scratch · After Monster Quest

Check every choice, save a working copy and explain the controls.

Recommended preparation: Scratch Monster Quest. Complete Monster Quest or bring equivalent Scratch experience. Build from a blank project, one small pictured action at a time.

Your goal

Test the whole RPG before sharing the finished project.

Try the adventure as a player before changing it. Keep a working copy so you can return to the version you have tested.

Do one step. Match the picture. Then move on.

  1. Select Stage’s thumbnail

    Test a complete adventure

    Start New Game and type a made-up nickname. Speak to Guide, type YES, then earn all three crystals. Use Heal before health reaches zero. The final portal should show the victory screen.

    Actual Scratch editor: Test a complete adventure. Start New Game and type a made-up nickname. Speak to Guide, type YES, then earn all three crystals. Use Heal before health reaches zero. The final portal should show the victory screen.
    1. Click: Run your test with the green flag
    2. Check: Check the Adventure Complete screen
    3. Click: Click Menu to play again
    Actual Scratch editor · step 1
  2. Select Guide

    Test the recovery route

    Start another game. Spend your potions, then visit Guide outside battle and type REST. Health should refill and an empty potion supply should become one. You should still be able to finish.

    Actual Scratch editor: Test the recovery route. Start another game. Spend your potions, then visit Guide outside battle and type REST. Health should refill and an empty potion supply should become one. You should still be able to finish.
    1. Click: Run your test with the green flag
    2. Check: Check the visible game counters
    3. Check: Read the result in Message
    Actual Scratch editor · step 2
  3. Select Stage’s thumbnail

    Test a saved victory

    Save in a cleared area and copy the code. Return to Menu, choose Continue and enter it. The enemy stays cleared, the next portal stays available, and your hero begins safely with full health.

    Actual Scratch editor: Test a saved victory. Save in a cleared area and copy the code. Return to Menu, choose Continue and enter it. The enemy stays cleared, the next portal stays available, and your hero begins safely with full health.
    1. Click: Run your test with the green flag
    2. Check: Check the visible game counters
    3. Check: Read the result in Message
    Actual Scratch editor · step 3
  4. Select Stage’s thumbnail

    Reject a broken code

    From the title screen, try R1035. Its check digit is wrong, so Continue must reject it. Enter your own valid code afterward and check that its area and potion count return.

    Actual Scratch editor: Reject a broken code. From the title screen, try R1035. Its check digit is wrong, so Continue must reject it. Enter your own valid code afterward and check that its area and potion count return.
    1. Click: Run your test with the green flag
    2. Check: A broken code shows this error
    3. Click: Click Continue to try a valid code
    Actual Scratch editor · step 4
  5. Select Stage’s thumbnail

    Save your editable game

    Choose File → Save to your computer. Keep the .sb3 file as your editable backup. A progress code saves a player’s adventure; this file saves your code, artwork and project.

    Actual Scratch editor: Save your editable game. Choose File → Save to your computer. Keep the .sb3 file as your editable backup. A progress code saves a player’s adventure; this file saves your code, artwork and project.
    1. Click: Open File
    2. Click: Save to your computer
    Actual Scratch editor · step 5
  6. Select Stage’s thumbnail

    Explain the controls

    Open See Project Page. In Instructions, explain arrow keys, clicking Guide, YES / HINT / REST, Attack / Heal / Run, and saving the displayed code. Say that Continue asks for the nickname again.

    Actual Scratch editor: Explain the controls. Open See Project Page. In Instructions, explain arrow keys, clicking Guide, YES / HINT / REST, Attack / Heal / Run, and saving the displayed code. Say that Continue asks for the nickname again.
    1. Click: Write your game controls in Instructions
    Actual Scratch editor · step 6
  7. Select Stage’s thumbnail

    Credit and share

    In Notes and Credits, credit Kenney’s Tiny Dungeon and Tiny Town CC0 artwork. Add the course name. Play once more, then click Share if your Scratch account allows it. Never include your real name.

    Actual Scratch editor: Credit and share. In Notes and Credits, credit Kenney’s Tiny Dungeon and Tiny Town CC0 artwork. Add the course name. Play once more, then click Share if your Scratch account allows it. Never include your real name.
    1. Check: Keep Kenney’s artwork credits here
    2. Check: Play your finished adventure once more
    Actual Scratch editor · step 7
Optional: full block guide and lesson comparison

Save your own project first. Loading an .sb3 replaces the project on screen. This comparison shows the end of lesson 10.

Download lesson 10 comparison · Download all lesson comparisons

Choose the named sprite in Scratch and read its blocks from top to bottom. Indented rows fit inside the block above. Keep one copy of each existing stack.

StageOpen the title screen
  1. Eventswhen green flag clicked
  2. Variablesset [GameState] to (menu)
  3. Looksswitch backdrop to [Title Screen]
  4. Variablesset [HeroName] to (Explorer)
  5. Variablesset [Message] to ()
  6. Variablesset [QuestReady] to (0)
  7. Variablesset [Area] to (1)
  8. Variablesset [Cleared] to (0)
  9. Variablesset [MaxHP] to ((10) + ((2) * (Area)))
  10. Variablesset [Power] to ((Area) + (2))
  11. Variablesset [HP] to (MaxHP)
  12. Variablesset [EnemyHP] to (0)
  13. Variablesset [EnemyPower] to (0)
  14. Variablesset [Potions] to (3)
  15. Variablesset [HeroLevel] to (1)
  16. Variablesset [Crystals] to (0)
  17. Variablesset [SavedCode] to ()
  18. Variablesset [EnteredCode] to ()
  19. Variablesset [CodeValid] to (0)
  20. Variablesset [CheckDigit] to (0)
  21. Variablesset [DigitIndex] to (2)
  22. Variableshide variable [SavedCode]
StageReset progress and begin
  1. Eventswhen I receive [new game]
  2. Variablesset [QuestReady] to (0)
  3. Variablesset [Area] to (1)
  4. Variablesset [Cleared] to (0)
  5. Variablesset [MaxHP] to ((10) + ((2) * (Area)))
  6. Variablesset [Power] to ((Area) + (2))
  7. Variablesset [HP] to (MaxHP)
  8. Variablesset [EnemyHP] to (0)
  9. Variablesset [EnemyPower] to (0)
  10. Variablesset [Potions] to (3)
  11. Variablesset [HeroLevel] to (1)
  12. Variablesset [Crystals] to (0)
  13. Eventsbroadcast [ask hero name] and wait
  14. Eventsbroadcast [load area] and wait
  15. Variablesset [GameState] to (explore)
StageShow the current area
  1. Eventswhen I receive [load area]
  2. Controlif <Area = 1> then
  3. Looksswitch backdrop to [Meadow Trail]
  4. elseSecond slot of the same if/else block
    Controlif <Area = 2> then
  5. Looksswitch backdrop to [Crystal Cavern]
  6. elseSecond slot of the same if/else block
    Looksswitch backdrop to [Ancient Ruins]
  7. Variablesset [Message] to (Click Guide. Type YES to begin.)
  8. Variablesset [HeroLevel] to (Area)
  9. Variablesset [Crystals] to (((Area) - (1)) + (Cleared))
StageAsk for a short hero nickname
  1. Eventswhen I receive [ask hero name]
  2. Variablesset [GameState] to (naming)
  3. Sensingask [Choose a made-up hero nickname (1–12 letters).] and wait
  4. Variablesset [HeroName] to (answer)
  5. Controlif <<length of [HeroName] = 0> or <length of [HeroName] > 12>> then
  6. Variablesset [HeroName] to (Explorer)
StageShow information only while playing
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<<GameState = explore> or <GameState = dialogue>> or <<<GameState = battle> or <GameState = turn>> or <GameState = save>>> then
  4. Variablesshow variable [HeroName]
  5. Variablesshow variable [HP]
  6. Variablesshow variable [MaxHP]
  7. Variablesshow variable [Potions]
  8. Variablesshow variable [Area]
  9. Variablesshow variable [HeroLevel]
  10. Variablesshow variable [Crystals]
  11. elseSecond slot of the same if/else block
    Variableshide variable [HeroName]
  12. Variableshide variable [HP]
  13. Variableshide variable [MaxHP]
  14. Variableshide variable [Potions]
  15. Variableshide variable [Area]
  16. Variableshide variable [HeroLevel]
  17. Variableshide variable [Crystals]
  18. Controlif <not <Message = >> then
  19. Variablesshow variable [Message]
  20. elseSecond slot of the same if/else block
    Variableshide variable [Message]
  21. Controlif <<GameState = battle> or <GameState = turn>> then
  22. Variablesshow variable [EnemyHP]
  23. elseSecond slot of the same if/else block
    Variableshide variable [EnemyHP]
  24. Controlif <GameState = save> then
  25. Variablesshow variable [SavedCode]
  26. elseSecond slot of the same if/else block
    Variableshide variable [SavedCode]
StageSet up a fair battle
  1. Eventswhen I receive [start battle]
  2. Variablesset [GameState] to (turn)
  3. Variablesset [EnemyHP] to ((8) * (Area))
  4. Variablesset [EnemyPower] to ((Area) + (1))
  5. Looksswitch backdrop to [Battle Arena]
  6. Variablesset [Message] to (Choose one battle action.)
  7. Variablesset [GameState] to (battle)
StageAttack once, then give the enemy a turn
  1. Eventswhen I receive [hero attack]
  2. Variableschange [EnemyHP] by ((0) - (Power))
  3. Controlif <EnemyHP < 0> then
  4. Variablesset [EnemyHP] to (0)
  5. Variablesset [Message] to (Your hero attacks!)
  6. Eventsbroadcast [enemy hurt] and wait
  7. Controlif <EnemyHP < 1> then
  8. Eventsbroadcast [battle won]
  9. elseSecond slot of the same if/else block
    Eventsbroadcast [enemy turn]
StageResolve one enemy attack
  1. Eventswhen I receive [enemy turn]
  2. Controlwait (0.25) seconds
  3. Variableschange [HP] by ((0) - (EnemyPower))
  4. Controlif <HP < 0> then
  5. Variablesset [HP] to (0)
  6. Variablesset [Message] to (The enemy strikes back!)
  7. Eventsbroadcast [hero hurt] and wait
  8. Controlif <HP < 1> then
  9. Variablesset [GameState] to (lost)
  10. Looksswitch backdrop to [Try Again]
  11. elseSecond slot of the same if/else block
    Variablesset [Message] to (Your turn: Attack, Heal or Run.)
  12. Variablesset [GameState] to (battle)
StageClear the area once
  1. Eventswhen I receive [battle won]
  2. Variablesset [Cleared] to (1)
  3. Variablesset [QuestReady] to (0)
  4. Variablesset [Crystals] to (Area)
  5. Eventsbroadcast [load area] and wait
  6. Variablesset [Message] to (Crystal earned! Walk to Portal.)
  7. Variablesset [GameState] to (explore)
StageUse one potion and give the enemy a turn
  1. Eventswhen I receive [heal hero]
  2. Variableschange [Potions] by (-1)
  3. Variableschange [HP] by (6)
  4. Controlif <HP > MaxHP> then
  5. Variablesset [HP] to (MaxHP)
  6. Variablesset [Message] to (Potion restores up to 6 HP.)
  7. Controlwait (0.3) seconds
  8. Eventsbroadcast [enemy turn]
StageRetreat without earning a crystal
  1. Eventswhen I receive [run away]
  2. Eventsbroadcast [load area] and wait
  3. Variablesset [Message] to (Retreated. HP and potions stay.)
  4. Variablesset [GameState] to (explore)
StageReturn to the title screen
  1. Eventswhen I receive [show menu]
  2. Variablesset [GameState] to (menu)
  3. Looksswitch backdrop to [Title Screen]
  4. Variablesset [Message] to ()
StageTravel onward or finish the adventure
  1. Eventswhen I receive [next area]
  2. Controlif <Area < 3> then
  3. Variableschange [Area] by (1)
  4. Variablesset [Cleared] to (0)
  5. Variablesset [QuestReady] to (0)
  6. Variablesset [MaxHP] to ((10) + ((2) * (Area)))
  7. Variablesset [Power] to ((Area) + (2))
  8. Variablesset [HP] to (MaxHP)
  9. Eventsbroadcast [load area] and wait
  10. Variablesset [GameState] to (explore)
  11. elseSecond slot of the same if/else block
    Variablesset [GameState] to (won)
  12. Variablesset [Message] to (Adventure complete!)
  13. Looksswitch backdrop to [Adventure Complete]
StageFreeze and make a five-character save code
  1. Eventswhen I receive [save game]
  2. Variablesset [SavedCode] to (R)
  3. Variablesset [SavedCode] to (join [SavedCode] [Area])
  4. Variablesset [SavedCode] to (join [SavedCode] [Cleared])
  5. Variablesset [SavedCode] to (join [SavedCode] [Potions])
  6. Variablesset [CheckDigit] to (((Area) + ((Cleared) + (Potions))) mod (10))
  7. Variablesset [SavedCode] to (join [SavedCode] [CheckDigit])
  8. Variablesset [Message] to (Write down code. Then Resume.)
StageResume at the same position
  1. Eventswhen I receive [resume game]
  2. Variablesset [Message] to (Click Guide for YES, HINT or REST.)
  3. Variablesset [GameState] to (explore)
StageCheck a code before changing progress
  1. My Blocksdefine check save code
  2. Variablesset [CodeValid] to (1)
  3. Controlif <not <<length of [EnteredCode] = 5> and <letter (1) of [EnteredCode] = R>>> then
  4. Variablesset [CodeValid] to (0)
  5. Variablesset [CheckDigit] to (0)
  6. Variablesset [DigitIndex] to (2)
  7. Controlrepeat (3)
  8. Controlif <not <[0123456789] contains [letter (DigitIndex) of [EnteredCode]]?>> then
  9. Variablesset [CodeValid] to (0)
  10. Variableschange [CheckDigit] by (letter (DigitIndex) of [EnteredCode])
  11. Variableschange [DigitIndex] by (1)
  12. Controlif <not <[0123456789] contains [letter (5) of [EnteredCode]]?>> then
  13. Variablesset [CodeValid] to (0)
  14. Controlif <not <<letter (2) of [EnteredCode] > 0> and <letter (2) of [EnteredCode] < 4>>> then
  15. Variablesset [CodeValid] to (0)
  16. Controlif <not <<letter (3) of [EnteredCode] > -1> and <letter (3) of [EnteredCode] < 2>>> then
  17. Variablesset [CodeValid] to (0)
  18. Controlif <not <<letter (4) of [EnteredCode] > -1> and <letter (4) of [EnteredCode] < 4>>> then
  19. Variablesset [CodeValid] to (0)
  20. Controlif <not <letter (5) of [EnteredCode] = (CheckDigit) mod (10)>> then
  21. Variablesset [CodeValid] to (0)
StageRestore a valid safe checkpoint
  1. Eventswhen I receive [continue game]
  2. Sensingask [Type a 5-character save code, such as R1034.] and wait
  3. Variablesset [EnteredCode] to (answer)
  4. My Blockscheck save code
  5. Controlif <CodeValid = 1> then
  6. Variablesset [Area] to (letter (2) of [EnteredCode])
  7. Variablesset [Cleared] to (letter (3) of [EnteredCode])
  8. Variablesset [Potions] to (letter (4) of [EnteredCode])
  9. Variablesset [QuestReady] to (0)
  10. Variablesset [MaxHP] to ((10) + ((2) * (Area)))
  11. Variablesset [Power] to ((Area) + (2))
  12. Variablesset [HP] to (MaxHP)
  13. Eventsbroadcast [ask hero name] and wait
  14. Eventsbroadcast [load area] and wait
  15. Variablesset [GameState] to (explore)
  16. elseSecond slot of the same if/else block
    Variablesset [Message] to (Invalid code. Please try Continue.)
  17. Variablesset [GameState] to (menu)
StartShow New Game on the title screen
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = menu> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
StartLock New Game before starting
  1. Eventswhen this sprite clicked
  2. Controlif <GameState = menu> then
  3. Variablesset [GameState] to (loading)
  4. Eventsbroadcast [new game]
HeroPlace the hero at a safe starting point
  1. Eventswhen I receive [load area]
  2. Looksclear graphic effects
  3. Motiongo to x: (-180) y: (-80)
  4. Variablesset [XSpeed] to (0)
  5. Variablesset [YSpeed] to (0)
  6. Variablesset [AnimTicks] to (0)
  7. Looksswitch costume to [Stand]
  8. Motionset rotation style [left-right]
  9. Motionpoint in direction (90)
HeroShow the hero only inside the adventure
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<<GameState = explore> or <GameState = dialogue>> or <<<GameState = battle> or <GameState = turn>> or <GameState = save>>> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
HeroRead arrow keys and move in four directions
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = explore> then
  4. Variablesset [XSpeed] to (0)
  5. Variablesset [YSpeed] to (0)
  6. Controlif <key [left arrow] pressed?> then
  7. Variableschange [XSpeed] by (-4)
  8. Controlif <key [right arrow] pressed?> then
  9. Variableschange [XSpeed] by (4)
  10. Controlif <key [up arrow] pressed?> then
  11. Variableschange [YSpeed] by (4)
  12. Controlif <key [down arrow] pressed?> then
  13. Variableschange [YSpeed] by (-4)
  14. Motionchange x by (XSpeed)
  15. Motionchange y by (YSpeed)
  16. My Blocksstay on map
HeroStay inside the map
  1. My Blocksdefine stay on map
  2. Controlif <x position > 215> then
  3. Motionset x to (215)
  4. Controlif <x position < -215> then
  5. Motionset x to (-215)
  6. Controlif <y position > 85> then
  7. Motionset y to (85)
  8. Controlif <y position < -120> then
  9. Motionset y to (-120)
HeroFace the way you move and animate your feet
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = explore> then
  4. Controlif <XSpeed < 0> then
  5. Motionpoint in direction (-90)
  6. Controlif <XSpeed > 0> then
  7. Motionpoint in direction (90)
  8. Controlif <<XSpeed = 0> and <YSpeed = 0>> then
  9. Looksswitch costume to [Stand]
  10. Variablesset [AnimTicks] to (0)
  11. elseSecond slot of the same if/else block
    Variableschange [AnimTicks] by (1)
  12. Controlif <AnimTicks > 3> then
  13. Looksnext costume
  14. Variablesset [AnimTicks] to (0)
HeroStand on the left for battle
  1. Eventswhen I receive [start battle]
  2. Motiongo to x: (-105) y: (-15)
  3. Looksswitch costume to [Stand]
  4. Motionpoint in direction (90)
HeroBegin a quest battle by touching the enemy
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<GameState = explore> and <<<QuestReady = 1> and <Cleared = 0>> and <touching [Enemy]?>>> then
  4. Variablesset [GameState] to (loading battle)
  5. Eventsbroadcast [start battle]
HeroFlash when the enemy hits
  1. Eventswhen I receive [hero hurt]
  2. Looksset [color] effect to (40)
  3. Motionchange x by (-6)
  4. Controlwait (0.12) seconds
  5. Motionchange x by (6)
  6. Looksclear graphic effects
HeroEnter the portal after earning a crystal
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<GameState = explore> and <<Cleared = 1> and <touching [Portal]?>>> then
  4. Variablesset [GameState] to (travel)
  5. Eventsbroadcast [next area]
GuidePlace the guide beside the path
  1. Eventswhen I receive [load area]
  2. Motiongo to x: (-75) y: (25)
GuideShow the guide on the map
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<<GameState = explore> or <GameState = dialogue>> or <GameState = save>> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
GuideListen to the player’s typed choice
  1. Eventswhen this sprite clicked
  2. Controlif <GameState = explore> then
  3. Variablesset [GameState] to (dialogue)
  4. Sensingask [Type YES for quest, HINT for help, or REST to recover.] and wait
  5. Controlif <answer = YES> then
  6. Controlif <Cleared = 0> then
  7. Variablesset [QuestReady] to (1)
  8. Variablesset [Message] to (Walk to the monster to battle.)
  9. elseSecond slot of the same if/else block
    Variablesset [Message] to (Area clear. Walk to Portal.)
  10. elseSecond slot of the same if/else block
    Controlif <answer = HINT> then
  11. Variablesset [Message] to (Arrows move. Touch foe after YES.)
  12. elseSecond slot of the same if/else block
    Controlif <answer = REST> then
  13. Variablesset [HP] to (MaxHP)
  14. Controlif <Potions = 0> then
  15. Variablesset [Potions] to (1)
  16. Variablesset [Message] to (Rested! At least one potion ready.)
  17. elseSecond slot of the same if/else block
    Variablesset [Message] to (Try YES, HINT or REST.)
  18. Variablesset [GameState] to (explore)
EnemyChoose the monster for this area
  1. Eventswhen I receive [load area]
  2. Looksclear graphic effects
  3. Motiongo to x: (125) y: (-30)
  4. Variablesset [AnimTicks] to (0)
  5. Controlif <Area = 1> then
  6. Looksswitch costume to [Slime 1]
  7. elseSecond slot of the same if/else block
    Controlif <Area = 2> then
  8. Looksswitch costume to [Skeleton 1]
  9. elseSecond slot of the same if/else block
    Looksswitch costume to [Bat 1]
EnemyHide a defeated enemy
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<<<<GameState = explore> or <GameState = dialogue>> or <GameState = save>> and <Cleared = 0>> or <<GameState = battle> or <GameState = turn>>> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
EnemyBlink while waiting for the hero
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<GameState = explore> or <GameState = battle>> then
  4. Variableschange [AnimTicks] by (1)
  5. Controlif <AnimTicks = 18> then
  6. Looksnext costume
  7. Controlif <AnimTicks > 21> then
  8. Controlif <Area = 1> then
  9. Looksswitch costume to [Slime 1]
  10. elseSecond slot of the same if/else block
    Controlif <Area = 2> then
  11. Looksswitch costume to [Skeleton 1]
  12. elseSecond slot of the same if/else block
    Looksswitch costume to [Bat 1]
  13. Variablesset [AnimTicks] to (0)
EnemyFace the hero across the battle arena
  1. Eventswhen I receive [start battle]
  2. Motiongo to x: (105) y: (-15)
  3. Controlif <Area = 1> then
  4. Looksswitch costume to [Slime 1]
  5. elseSecond slot of the same if/else block
    Controlif <Area = 2> then
  6. Looksswitch costume to [Skeleton 1]
  7. elseSecond slot of the same if/else block
    Looksswitch costume to [Bat 1]
EnemyFlash and recoil when hit
  1. Eventswhen I receive [enemy hurt]
  2. Looksset [color] effect to (40)
  3. Motionchange x by (6)
  4. Controlwait (0.12) seconds
  5. Motionchange x by (-6)
  6. Looksclear graphic effects
PortalPlace the portal at the right edge
  1. Eventswhen I receive [load area]
  2. Motiongo to x: (205) y: (15)
PortalShow the portal only after the battle is won
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<<<GameState = explore> or <GameState = dialogue>> or <GameState = save>> and <Cleared = 1>> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
AttackShow Attack when it can be used
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = battle> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
AttackUse Attack once per turn
  1. Eventswhen this sprite clicked
  2. Controlif <GameState = battle> then
  3. Variablesset [GameState] to (turn)
  4. Eventsbroadcast [hero attack]
HealShow Heal when it can be used
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = battle> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
HealUse Heal once per turn
  1. Eventswhen this sprite clicked
  2. Controlif <GameState = battle> then
  3. Controlif <<Potions > 0> and <HP < MaxHP>> then
  4. Variablesset [GameState] to (turn)
  5. Eventsbroadcast [heal hero]
  6. elseSecond slot of the same if/else block
    Variablesset [Message] to (Need missing HP and a potion.)
RunShow Run when it can be used
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = battle> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
RunUse Run once per turn
  1. Eventswhen this sprite clicked
  2. Controlif <GameState = battle> then
  3. Variablesset [GameState] to (retreat)
  4. Eventsbroadcast [run away]
MenuShow Menu when it can be used
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<<GameState = lost> or <GameState = won>> or <GameState = save>> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
MenuKeep Menu clear of the save code
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = save> then
  4. Motiongo to x: (155) y: (-125)
  5. elseSecond slot of the same if/else block
    Motiongo to x: (0) y: (-80)
MenuUse Menu once per turn
  1. Eventswhen this sprite clicked
  2. Controlif <<<GameState = lost> or <GameState = won>> or <GameState = save>> then
  3. Variablesset [GameState] to (leaving)
  4. Eventsbroadcast [show menu]
SaveShow Save when it can be used
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = explore> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
SaveUse Save once per turn
  1. Eventswhen this sprite clicked
  2. Controlif <GameState = explore> then
  3. Variablesset [GameState] to (save)
  4. Eventsbroadcast [save game]
ResumeShow Resume when it can be used
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = save> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
ResumeUse Resume once per turn
  1. Eventswhen this sprite clicked
  2. Controlif <GameState = save> then
  3. Variablesset [GameState] to (resuming)
  4. Eventsbroadcast [resume game]
ContinueShow Continue when it can be used
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = menu> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
ContinueUse Continue once per turn
  1. Eventswhen this sprite clicked
  2. Controlif <GameState = menu> then
  3. Variablesset [GameState] to (loading)
  4. Eventsbroadcast [continue game]
END OF LESSON

Ready for the next step?

Return here anytime to review.

Finished project

Crystal Trail RPG

Name an animated hero, explore three areas, talk to the guide and face a different enemy in each area. Choose Attack, Heal or Run during turn-based battles. Record a five-character save code, then use Continue to restart safely in the saved area with full health and your saved progress and potions.

Compare this working example with your own project. It opens in a new tab.

Play the finished Crystal Trail RPG
Comments

Lesson discussion

Ask a question or help a classmate. Mr. S can reply here.

Loading discussion…