Unit 2 · Lesson 3

Explore three worlds and collect gems

  • Monsters and worlds
  • 90 minutes
  • Advanced Scratch · After Pixel Quest

Add the exit flag, optional gems and two more worlds.

Recommended preparation: Scratch Pixel Quest. Complete Pixel Quest or bring equivalent Scratch platformer experience. Follow one short pictured action at a time.

Your goal

Advance through three levels while preserving lives and counting each gem once.

Keep the working controls and monsters. A flag leads to the next world. Gems are optional, and each gem can be collected only once per level.

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

  1. Select Stage’s thumbnail

    Add the other two worlds

    On Stage’s Backdrops tab, upload cavern-backdrop.svg and summit-backdrop.svg. Name them Crystal Cavern and Moonlit Summit. Keep Meadow Steps and the earlier menu/result pictures.

    Actual Scratch editor: Add the other two worlds. On Stage’s Backdrops tab, upload cavern-backdrop.svg and summit-backdrop.svg. Name them Crystal Cavern and Moonlit Summit. Keep Meadow Steps and the earlier menu/result pictures.
    1. Click: Open Backdrops
    2. Click: Point at Choose a Backdrop
    3. Click: Click Upload Backdrop
    4. Click: Rename this picture
    Actual Scratch editor · step 1
  2. Select Stage’s thumbnail

    Add the winning screen

    Upload win-screen.svg as a Stage backdrop and name it Adventure complete. The final flag will show it.

    Actual Scratch editor: Add the winning screen. Upload win-screen.svg as a Stage backdrop and name it Adventure complete. The final flag will show it.
    1. Click: Open Backdrops
    2. Click: Point at Choose a Backdrop
    3. Click: Click Upload Backdrop
    4. Click: Rename this picture
    Actual Scratch editor · step 2
  3. Select Platforms

    Add two more platform costumes

    Select Platforms → Costumes → Upload Costume. Add cavern-platforms.png and summit-platforms.png. Keep meadow first, cavern second and summit third. Leave x 0, y 0 and Size 100.

    Actual Scratch editor: Add two more platform costumes. Select Platforms → Costumes → Upload Costume. Add cavern-platforms.png and summit-platforms.png. Keep meadow first, cavern second and summit third. Leave x 0, y 0 and Size 100.
    1. Click: Open Costumes
    2. Click: Point at Choose a Costume
    3. Click: Click Upload Costume
    4. Click: Rename this picture
    Actual Scratch editor · step 3
  4. Select Hazards

    Add the matching spike costumes

    On Hazards, upload cavern-hazards.png and summit-hazards.png as costumes. Keep meadow, cavern, summit order. Level can now choose the same numbered map on both sprites.

    Actual Scratch editor: Add the matching spike costumes. On Hazards, upload cavern-hazards.png and summit-hazards.png as costumes. Keep meadow, cavern, summit order. Level can now choose the same numbered map on both sprites.
    1. Click: Open Costumes
    2. Click: Point at Choose a Costume
    3. Click: Click Upload Costume
    4. Click: Rename this picture
    Actual Scratch editor · step 4
  5. Select Stage’s thumbnail

    Make the gem totals

    On Stage, make Banked and Gems. Untick both boxes. Banked remembers gems from completed worlds. Gems displays the adventure’s total.

    Actual Scratch editor: Make the gem totals. On Stage, make Banked and Gems. Untick both boxes. Banked remembers gems from completed worlds. Gems displays the adventure’s total.
    1. Click: Make each named variable
    2. Click: Untick the variable monitor boxes
    Actual Scratch editor · step 5
  6. Select Stage’s thumbnail

    Remember which gems were taken

    On Stage, make Gem1Taken, Gem2Taken and Gem3Taken. Untick their boxes. Each flag is 0 before its gem is taken, or 1 afterward.

    Actual Scratch editor: Remember which gems were taken. On Stage, make Gem1Taken, Gem2Taken and Gem3Taken. Untick their boxes. Each flag is 0 before its gem is taken, or 1 afterward.
    1. Click: Make each named variable
    2. Click: Untick the variable monitor boxes
    Actual Scratch editor · step 6
  7. Select Stage’s thumbnail

    Clear the gem flags for a new game

    In Stage’s new game stack, set Banked, Gems and all three Taken flags to 0 before loading. Copy those five resets into the green-flag stack too. Hide Gems while the menu is open.

    Actual Scratch editor: Clear the gem flags for a new game. In Stage’s new game stack, set Banked, Gems and all three Taken flags to 0 before loading. Copy those five resets into the green-flag stack too. Hide Gems while the menu is open.
    1. Add: Build stack 1 in this order
    2. Add: Build stack 2 in this order
    3. Add: Build stack 3 in this order
    Actual Scratch editor · step 7
  8. Select Stage’s thumbnail

    Choose the backdrop for Level

    Update Stage’s load level receiver. Level 1 chooses Meadow Steps; Level 2 chooses Crystal Cavern; otherwise choose Moonlit Summit. Set Gems to Banked plus the three Taken flags, then show Gems.

    Actual Scratch editor: Choose the backdrop for Level. Update Stage’s load level receiver. Level 1 chooses Meadow Steps; Level 2 chooses Crystal Cavern; otherwise choose Moonlit Summit. Set Gems to Banked plus the three Taken flags, then show Gems.
    1. Add: Add or update the highlighted blocks
    Actual Scratch editor · step 8
  9. Add Flag

    Upload the exit flag

    Upload flag.png as a new sprite named Flag. Keep Size 100. Its load receiver will place it on the highest platform.

    Actual Scratch editor: Upload the exit flag. Upload flag.png as a new sprite named Flag. Keep Size 100. Its load receiver will place it on the highest platform.
    1. Click: Point at Choose a Sprite
    2. Click: Click Upload Sprite
    Actual Scratch editor · step 9
  10. Select Flag

    Place and hide the flag

    On Flag, add load level → go to x 190 y 90 → show. Copy Player’s show menu → hide and game ended → hide receivers onto Flag.

    Actual Scratch editor: Place and hide the flag. On Flag, add load level → go to x 190 y 90 → show. Copy Player’s show menu → hide and game ended → hide receivers onto Flag.
    1. Add: Build this left stack
    2. Add: Build this right stack
    Actual Scratch editor · step 10
  11. Select Player

    Ask to leave a level only once

    At the end of Player’s playing loop, add if GameState = playing and touching Flag. Inside it, set GameState to transition, then broadcast exit reached.

    Actual Scratch editor: Ask to leave a level only once. At the end of Player’s playing loop, add if GameState = playing and touching Flag. Inside it, set GameState to transition, then broadcast exit reached.
    1. Add: Add or update the highlighted blocks
    Actual Scratch editor · step 11
  12. Select Stage’s thumbnail

    Keep gems from the finished world

    On Stage, start the exit reached receiver shown. Inside GameState = transition, add if Level < 3 then/else. In the top branch, add the three Taken flags to Banked, then change Level by 1.

    Actual Scratch editor: Keep gems from the finished world. On Stage, start the exit reached receiver shown. Inside GameState = transition, add if Level < 3 then/else. In the top branch, add the three Taken flags to Banked, then change Level by 1.
    1. Add: Add or update the highlighted blocks
    Actual Scratch editor · step 12
  13. Select Stage’s thumbnail

    Load the next world

    Below change Level, set Gem1Taken, Gem2Taken and Gem3Taken to 0. Broadcast load level and wait, then set GameState to playing. Keep all five blocks in the Level < 3 branch.

    Actual Scratch editor: Load the next world. Below change Level, set Gem1Taken, Gem2Taken and Gem3Taken to 0. Broadcast load level and wait, then set GameState to playing. Keep all five blocks in the Level < 3 branch.
    1. Add: Add or update the highlighted blocks
    Actual Scratch editor · step 13
  14. Select Stage’s thumbnail

    Win after the third flag

    In the Level check’s else branch, set GameState to won, switch backdrop to Adventure complete and broadcast game ended. Gems are optional; reaching the flag completes a world.

    Actual Scratch editor: Win after the third flag. In the Level check’s else branch, set GameState to won, switch backdrop to Adventure complete and broadcast game ended. Gems are optional; reaching the flag completes a world.
    1. Add: Add or update the highlighted blocks
    Actual Scratch editor · step 14
  15. Select Menu

    Let Menu work after either ending

    In both Menu stacks, change the condition to GameState = lost or GameState = won. Keep go to front layer after show. Menu now works after a win too.

    Actual Scratch editor: Let Menu work after either ending. In both Menu stacks, change the condition to GameState = lost or GameState = won. Keep go to front layer after show. Menu now works after a win too.
    1. Add: Build this left stack
    2. Add: Build this right stack
    Actual Scratch editor · step 15
  16. Add Gem1

    Upload the first gem

    Upload gem.png as a new sprite named Gem1. Keep Size 100. Do not upload it as a backdrop.

    Actual Scratch editor: Upload the first gem. Upload gem.png as a new sprite named Gem1. Keep Size 100. Do not upload it as a backdrop.
    1. Click: Point at Choose a Sprite
    2. Click: Click Upload Sprite
    Actual Scratch editor · step 16
  17. Select Gem1

    Restore whether Gem1 is already taken

    On Gem1, add load level → go to x -144 y -60 → if Gem1Taken = 0 show, else hide. The flag controls whether this gem is still available.

    Actual Scratch editor: Restore whether Gem1 is already taken. On Gem1, add load level → go to x -144 y -60 → if Gem1Taken = 0 show, else hide. The flag controls whether this gem is still available.
    1. Add: Add or update the highlighted blocks
    Actual Scratch editor · step 17
  18. Select Gem1

    Collect Gem1 only once

    Add the pictured green-flag loop. It checks GameState = playing, Gem1Taken = 0 and touching Player. Inside that check, set Gem1Taken to 1 and hide.

    Actual Scratch editor: Collect Gem1 only once. Add the pictured green-flag loop. It checks GameState = playing, Gem1Taken = 0 and touching Player. Inside that check, set Gem1Taken to 1 and hide.
    1. Add: Add or update the highlighted blocks
    Actual Scratch editor · step 18
  19. Select Gem1

    Update the displayed total

    After hide, set Gems to Banked + Gem1Taken + Gem2Taken + Gem3Taken. Nest the green plus blocks as shown. Each Taken flag adds either 0 or 1.

    Actual Scratch editor: Update the displayed total. After hide, set Gems to Banked + Gem1Taken + Gem2Taken + Gem3Taken. Nest the green plus blocks as shown. Each Taken flag adds either 0 or 1.
    1. Add: Build these blocks in this order
    Actual Scratch editor · step 19
  20. Select Gem1

    Hide Gem1 outside the world

    Copy Player’s show menu → hide and game ended → hide receivers onto Gem1. These do not change its Taken flag.

    Actual Scratch editor: Hide Gem1 outside the world. Copy Player’s show menu → hide and game ended → hide receivers onto Gem1. These do not change its Taken flag.
    1. Add: Build this left stack
    2. Add: Build this right stack
    Actual Scratch editor · step 20
  21. Select Gem2

    Make Gem2 from the working gem

    Duplicate Gem1 and rename the copy Gem2. Set its load position to x -36 y -6. Change the load/collect tests and set-variable block to Gem2Taken. Keep the Gems total’s sum of all three flags unchanged.

    Actual Scratch editor: Make Gem2 from the working gem. Duplicate Gem1 and rename the copy Gem2. Set its load position to x -36 y -6. Change the load/collect tests and set-variable block to Gem2Taken. Keep the Gems total’s sum of all three flags unchanged.
    1. Add: Build this left stack
    2. Add: Build this right stack
    Actual Scratch editor · step 21
  22. Select Gem3

    Make Gem3 the same way

    Duplicate Gem1 and rename the copy Gem3. Set its load position to x 72 y 48. Use Gem3Taken in its load/collect tests and set-variable block. Keep all three flags in the Gems total.

    Actual Scratch editor: Make Gem3 the same way. Duplicate Gem1 and rename the copy Gem3. Set its load position to x 72 y 48. Use Gem3Taken in its load/collect tests and set-variable block. Keep all three flags in the Gems total.
    1. Add: Build this left stack
    2. Add: Build this right stack
    Actual Scratch editor · step 22
  23. Select Stage’s thumbnail

    Test all three worlds and save

    Start a game. Collect a gem once, reach each flag, and watch the world change. Lives carry forward. After the third flag, Menu still works. Save as Monster Quest Lesson 07.

    Actual Scratch editor: Test all three worlds and save. Start a game. Collect a gem once, reach each flag, and watch the world change. Lives carry forward. After the third flag, Menu still works. Save as Monster Quest Lesson 07.
    1. Click: Run your test with the green flag
    2. Check: Check the game counters and messages
    3. Check: Run the movement or adventure test here
    Actual Scratch editor · step 23
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 7.

Download lesson 7 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. Variablesset [Level] to (1)
  4. Variablesset [Lives] to (3)
  5. Variablesset [Banked] to (0)
  6. Variablesset [Gems] to (0)
  7. Variablesset [Gem1Taken] to (0)
  8. Variablesset [Gem2Taken] to (0)
  9. Variablesset [Gem3Taken] to (0)
  10. Looksswitch backdrop to [Title Screen]
  11. Variableshide variable [Level]
  12. Variableshide variable [Lives]
  13. Variableshide variable [Gems]
  14. Eventsbroadcast [show menu]
StageBegin a new game
  1. Eventswhen I receive [new game]
  2. Variablesset [GameState] to (loading)
  3. Variablesset [Level] to (1)
  4. Variablesset [Lives] to (3)
  5. Variablesset [Banked] to (0)
  6. Variablesset [Gems] to (0)
  7. Variablesset [Gem1Taken] to (0)
  8. Variablesset [Gem2Taken] to (0)
  9. Variablesset [Gem3Taken] to (0)
  10. Eventsbroadcast [load level] and wait
  11. Variablesset [GameState] to (playing)
StageLoad the selected level backdrop and counters
  1. Eventswhen I receive [load level]
  2. Controlif <Level = 1> then
  3. Looksswitch backdrop to [Meadow Steps]
  4. elseSecond slot of the same if/else block
    Controlif <Level = 2> then
  5. Looksswitch backdrop to [Crystal Cavern]
  6. elseSecond slot of the same if/else block
    Looksswitch backdrop to [Moonlit Summit]
  7. Variablesshow variable [Level]
  8. Variablesshow variable [Lives]
  9. Variablesset [Gems] to ((Banked) + ((Gem1Taken) + ((Gem2Taken) + (Gem3Taken))))
  10. Variablesshow variable [Gems]
StageReturn safely to the title screen
  1. Eventswhen I receive [show menu]
  2. Variablesset [GameState] to (menu)
  3. Looksswitch backdrop to [Title Screen]
  4. Variableshide variable [Level]
  5. Variableshide variable [Lives]
  6. Variableshide variable [Gems]
StageLose one life and respawn or end
  1. Eventswhen I receive [player hit]
  2. Controlif <GameState = hurt> then
  3. Variableschange [Lives] by (-1)
  4. Controlif <Lives > 0> then
  5. Eventsbroadcast [respawn] and wait
  6. Variablesset [GameState] to (playing)
  7. elseSecond slot of the same if/else block
    Variablesset [GameState] to (lost)
  8. Looksswitch backdrop to [Out of lives]
  9. Eventsbroadcast [game ended]
StageBank gems and advance to the next flag
  1. Eventswhen I receive [exit reached]
  2. Controlif <GameState = transition> then
  3. Controlif <Level < 3> then
  4. Variableschange [Banked] by ((Gem1Taken) + ((Gem2Taken) + (Gem3Taken)))
  5. Variableschange [Level] by (1)
  6. Variablesset [Gem1Taken] to (0)
  7. Variablesset [Gem2Taken] to (0)
  8. Variablesset [Gem3Taken] to (0)
  9. Eventsbroadcast [load level] and wait
  10. Variablesset [GameState] to (playing)
  11. elseSecond slot of the same if/else block
    Variablesset [GameState] to (won)
  12. Looksswitch backdrop to [Adventure complete]
  13. Eventsbroadcast [game ended]
PlatformsLoad the level platforms costume
  1. Eventswhen I receive [load level]
  2. Motiongo to x: (0) y: (0)
  3. Looksswitch costume to [Level]
  4. Looksshow
PlatformsHide platforms on the menu
  1. Eventswhen I receive [show menu]
  2. Lookshide
PlatformsHide platforms on result screens
  1. Eventswhen I receive [game ended]
  2. Lookshide
PlayerPlace the explorer at the level start
  1. Eventswhen I receive [load level]
  2. Motiongo to x: (-210) y: (-126)
  3. Variablesset [XSpeed] to (0)
  4. Variablesset [YSpeed] to (0)
  5. Variablesset [Grounded] to (0)
  6. Variablesset [JumpHeld] to (0)
  7. Variablesset [StepY] to (-1)
  8. Variablesset [AnimTicks] to (0)
  9. Looksswitch costume to [Walk 1]
  10. Motionset rotation style [left-right]
  11. Motionpoint in direction (90)
  12. Variablesset [Invincible] to (0)
  13. Looksshow
PlayerHide the explorer on the title screen
  1. Eventswhen I receive [show menu]
  2. Lookshide
PlayerMove one horizontal pixel at a time
  1. My Blocksdefine move horizontally
  2. Controlrepeat (abs of (XSpeed))
  3. Motionchange x by ((XSpeed) / (abs of (XSpeed)))
  4. Controlif <touching [Platforms]?> then
  5. Motionchange x by ((0) - ((XSpeed) / (abs of (XSpeed))))
  6. Controlif <x position > 225> then
  7. Motionset x to (225)
  8. Controlif <x position < -225> then
  9. Motionset x to (-225)
PlayerLand on solid platforms a pixel at a time
  1. My Blocksdefine move vertically
  2. Variablesset [Grounded] to (0)
  3. Variablesset [StepY] to (-1)
  4. Controlif <YSpeed > 0> then
  5. Variablesset [StepY] to (1)
  6. Controlrepeat (abs of (round (YSpeed)))
  7. Motionchange y by (StepY)
  8. Controlif <touching [Platforms]?> then
  9. Motionchange y by ((0) - (StepY))
  10. Controlif <StepY < 0> then
  11. Variablesset [Grounded] to (1)
  12. Variablesset [YSpeed] to (0)
PlayerRead keys, move, jump and check the active adventure
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = playing> then
  4. Variablesset [XSpeed] to (0)
  5. Controlif <key [left arrow] pressed?> then
  6. Variableschange [XSpeed] by (-4)
  7. Controlif <key [right arrow] pressed?> then
  8. Variableschange [XSpeed] by (4)
  9. My Blocksmove horizontally
  10. Controlif <key [space] pressed?> then
  11. Controlif <<JumpHeld = 0> and <Grounded = 1>> then
  12. Variablesset [YSpeed] to (11)
  13. Variablesset [JumpHeld] to (1)
  14. elseSecond slot of the same if/else block
    Variablesset [JumpHeld] to (0)
  15. Variableschange [YSpeed] by (-0.7)
  16. Controlif <YSpeed < -12> then
  17. Variablesset [YSpeed] to (-12)
  18. My Blocksmove vertically
  19. Controlif <XSpeed < 0> then
  20. Motionpoint in direction (-90)
  21. Controlif <XSpeed > 0> then
  22. Motionpoint in direction (90)
  23. Controlif <Grounded = 0> then
  24. Looksswitch costume to [Walk 2]
  25. elseSecond slot of the same if/else block
    Controlif <XSpeed = 0> then
  26. Looksswitch costume to [Walk 1]
  27. Variablesset [AnimTicks] to (0)
  28. elseSecond slot of the same if/else block
    Variableschange [AnimTicks] by (1)
  29. Controlif <AnimTicks > 3> then
  30. Looksnext costume
  31. Variablesset [AnimTicks] to (0)
  32. Controlif <Invincible > 0> then
  33. Variableschange [Invincible] by (-1)
  34. Controlif <<Invincible = 0> and <<<touching [Hazards]?> or <touching [Crawler]?>> or <<touching [Bat]?> or <y position < -170>>>> then
  35. Variablesset [GameState] to (hurt)
  36. Eventsbroadcast [player hit]
  37. Controlif <<GameState = playing> and <touching [Flag]?>> then
  38. Variablesset [GameState] to (transition)
  39. Eventsbroadcast [exit reached]
PlayerReset motion and give brief hit protection
  1. Eventswhen I receive [respawn]
  2. Motiongo to x: (-210) y: (-126)
  3. Variablesset [XSpeed] to (0)
  4. Variablesset [YSpeed] to (0)
  5. Variablesset [Grounded] to (0)
  6. Variablesset [JumpHeld] to (0)
  7. Variablesset [StepY] to (-1)
  8. Variablesset [AnimTicks] to (0)
  9. Looksswitch costume to [Walk 1]
  10. Motionset rotation style [left-right]
  11. Motionpoint in direction (90)
  12. Variablesset [Invincible] to (30)
  13. Looksshow
PlayerHide the explorer when a run ends
  1. Eventswhen I receive [game ended]
  2. Lookshide
CrawlerPlace and reset Crawler
  1. Eventswhen I receive [load level]
  2. Motiongo to x: (170) y: (-132)
  3. Variablesset [AnimTicks] to (0)
  4. Variablesset [Speed] to (2)
  5. Looksswitch costume to [1]
  6. Looksshow
CrawlerHide Crawler on the menu
  1. Eventswhen I receive [show menu]
  2. Lookshide
CrawlerPatrol the floor and animate the crawler
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = playing> then
  4. Motionchange x by (Speed)
  5. Controlif <x position > 206> then
  6. Variablesset [Speed] to (-2)
  7. Controlif <x position < 154> then
  8. Variablesset [Speed] to (2)
  9. Variableschange [AnimTicks] by (1)
  10. Controlif <AnimTicks > 3> then
  11. Looksnext costume
  12. Variablesset [AnimTicks] to (0)
CrawlerHide Crawler when the run ends
  1. Eventswhen I receive [game ended]
  2. Lookshide
BatPlace and reset Bat
  1. Eventswhen I receive [load level]
  2. Motiongo to x: (0) y: (45)
  3. Variablesset [AnimTicks] to (0)
  4. Variablesset [Phase] to (0)
  5. Looksswitch costume to [1]
  6. Looksshow
BatHide Bat on the menu
  1. Eventswhen I receive [show menu]
  2. Lookshide
BatFly in a loop and animate the bat
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = playing> then
  4. Variableschange [Phase] by (8)
  5. Motiongo to x: ((70) * (sin of (Phase))) y: ((45) + ((18) * (cos of (Phase))))
  6. Variableschange [AnimTicks] by (1)
  7. Controlif <AnimTicks > 3> then
  8. Looksnext costume
  9. Variablesset [AnimTicks] to (0)
BatHide Bat when the run ends
  1. Eventswhen I receive [game ended]
  2. Lookshide
HazardsLoad the level hazards costume
  1. Eventswhen I receive [load level]
  2. Motiongo to x: (0) y: (0)
  3. Looksswitch costume to [Level]
  4. Looksshow
HazardsHide hazards on the menu
  1. Eventswhen I receive [show menu]
  2. Lookshide
HazardsHide hazards on result screens
  1. Eventswhen I receive [game ended]
  2. Lookshide
FlagPut the exit on the top platform
  1. Eventswhen I receive [load level]
  2. Motiongo to x: (190) y: (90)
  3. Looksshow
FlagHide the exit outside the world
  1. Eventswhen I receive [show menu]
  2. Lookshide
FlagHide the exit outside the world
  1. Eventswhen I receive [game ended]
  2. Lookshide
Gem1Restore whether this gem was already taken
  1. Eventswhen I receive [load level]
  2. Motiongo to x: (-144) y: (-60)
  3. Controlif <Gem1Taken = 0> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
Gem1Count this optional gem just once
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<GameState = playing> and <<Gem1Taken = 0> and <touching [Player]?>>> then
  4. Variablesset [Gem1Taken] to (1)
  5. Lookshide
  6. Variablesset [Gems] to ((Banked) + ((Gem1Taken) + ((Gem2Taken) + (Gem3Taken))))
Gem1Hide the gem outside the world
  1. Eventswhen I receive [show menu]
  2. Lookshide
Gem1Hide the gem outside the world
  1. Eventswhen I receive [game ended]
  2. Lookshide
Gem2Restore whether this gem was already taken
  1. Eventswhen I receive [load level]
  2. Motiongo to x: (-36) y: (-6)
  3. Controlif <Gem2Taken = 0> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
Gem2Count this optional gem just once
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<GameState = playing> and <<Gem2Taken = 0> and <touching [Player]?>>> then
  4. Variablesset [Gem2Taken] to (1)
  5. Lookshide
  6. Variablesset [Gems] to ((Banked) + ((Gem1Taken) + ((Gem2Taken) + (Gem3Taken))))
Gem2Hide the gem outside the world
  1. Eventswhen I receive [show menu]
  2. Lookshide
Gem2Hide the gem outside the world
  1. Eventswhen I receive [game ended]
  2. Lookshide
Gem3Restore whether this gem was already taken
  1. Eventswhen I receive [load level]
  2. Motiongo to x: (72) y: (48)
  3. Controlif <Gem3Taken = 0> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
Gem3Count this optional gem just once
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<GameState = playing> and <<Gem3Taken = 0> and <touching [Player]?>>> then
  4. Variablesset [Gem3Taken] to (1)
  5. Lookshide
  6. Variablesset [Gems] to ((Banked) + ((Gem1Taken) + ((Gem2Taken) + (Gem3Taken))))
Gem3Hide the gem outside the world
  1. Eventswhen I receive [show menu]
  2. Lookshide
Gem3Hide the gem outside the world
  1. Eventswhen I receive [game ended]
  2. Lookshide
StartShow New Game only on the menu
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <GameState = menu> then
  4. Looksshow
  5. elseSecond slot of the same if/else block
    Lookshide
StartStart from the menu
  1. Eventswhen this sprite clicked
  2. Controlif <GameState = menu> then
  3. Eventsbroadcast [new game]
MenuShow Menu only when it can be used
  1. Eventswhen green flag clicked
  2. Controlforever
  3. Controlif <<GameState = lost> or <GameState = won>> then
  4. Looksshow
  5. Looksgo to [front] layer
  6. elseSecond slot of the same if/else block
    Lookshide
MenuUse the Menu control
  1. Eventswhen this sprite clicked
  2. Controlif <<GameState = lost> or <GameState = won>> then
  3. Eventsbroadcast [show menu]
END OF LESSON

Ready for the next step?

Return here anytime to review.

Comments

Lesson discussion

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

Loading discussion…