Earth's Layers - A Platformer
@Stage\n\nwhen I receive [start v]\nset [lvl# v] to [0]\nforever\n    if <(lvl#) < [4]> then\n        switch backdrop to (1 v)\n    else\n        if <(lvl#) < [9]> then\n            switch backdrop to (2 v)\n        else\n            if <(lvl#) < [14]> then\n                switch backdrop to (3 v)\n            else\n                if <(lvl#) < [15]> then\n                    switch backdrop to (4 v)\n                else\n                    switch backdrop to (5 v)\n                end\n            end\n        end\n    end\nend\n\n@thumb\n\nwhen flag clicked\nhide variable [level v]\ngo to [front v] layer\nshow\nwait (3) seconds\nbroadcast (start v)\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\nclear graphic effects\n\nshow\ngo to [front v] layer\nhide variable [level v]\n\n@player\n\ndefine touch ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (ground v)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [speedy v] to [0]\nend\n\ndefine walk (direction) (speed)\nset [walljump v] to [0]\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (ground v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\n    if <<key (up arrow v) pressed?> and <([abs v] of (speed) ) > [3]>> then\n        if <(walljump) = [0]> then\n            set [speedx v] to ((-2) * (speed))\n            set [speedy v] to [11]\n            set [falling? v] to [6]\n            set [walljump v] to [15]\n        end\n    else\n        set [falling? v] to [0]\n    end\nend\n\ndefine sensing\nif <<touching color (#ff0000)?> or <touching color (#0023ff)?>> then\n    set [speedy v] to [-0.1]\n    if <key (down arrow v) pressed?> then\n        set [speedy v] to [-2]\n    end\n    if <key (up arrow v) pressed?> then\n        set [speedy v] to [4]\n    end\nend\nif <<(y position) < [-175]> or <touching color (#003cff)?>> then\n    reset player data\nelse\n    if <touching color (#ff00e4)?> then\n        set [speedy v] to [24]\n    else\n        if <touching color (#ffdd9b)?> then\n            set [speedy v] to [0]\n            if <key (right arrow v) pressed?> then\n                set [speedx v] to [0.3]\n            end\n            if <key (left arrow v) pressed?> then\n                set [speedx v] to [-0.3]\n            end\n        end\n    end\nend\n\ndefine reset player data\ngo to x: (-185) y: (0)\nset [speedy v] to [0]\nset [speedx v] to [0]\n\nwhen I receive [start v]\nshow variable [level v]\nforever\n    set [level v] to ((lvl#) + (1))\n    if <(x position) > [235]> then\n        if <not <<<<(lvl#) = [3]> or <(lvl#) = [8]>> or <(lvl#) = [13]>> or <<(lvl#) = [14]> or <(lvl#) = [17]>>>> then\n            reset player data\n            change [lvl# v] by (1)\n        end\n    end\n    if <<<<<(lvl#) = [3]> or <(lvl#) = [8]>> or <(lvl#) = [13]>> or <(lvl#) = [14]>> and <(y position) < [-175]>> then\n        reset player data\n        change [lvl# v] by (1)\n    end\n    if <key (r v) pressed?> then\n        reset player data\n    end\n    sensing\nend\n\nwhen I receive [start v]\nreset player data\ngo to [front v] layer\nset rotation style [left-right v]\nforever\n    if <<key (up arrow v) pressed?> and <(falling?) < [3]>> then\n        if <not <touching color (#ffdd9b)?>> then\n            set [speedy v] to [13]\n        end\n    end\n    if <(walljump) > [0]> then\n        change [walljump v] by (-1)\n    else\n        set [speedx v] to ((speedx) * (0.7))\n        if <key (left arrow v) pressed?> then\n            change [speedx v] by (-2)\n        end\n        if <key (right arrow v) pressed?> then\n            change [speedx v] by (2)\n        end\n    end\n    if <(speedx) < [-0.5]> then\n        walk [-90] (speedx)\n    else\n        if <(speedx) > [0.5]> then\n            walk [90] (speedx)\n        end\n    end\n    change [speedy v] by (-1)\n    change y by (speedy)\n    touch ground <(speedy) > [0]>\nend\n\nhide variable [level v]\n\n@ground\n\nwhen flag clicked\nforever\n    switch costume to ((lvl#) + (1))\nend\n\n@Other\n\nwhen flag clicked\ngo to [back v] layer\nswitch costume to (1 v)\n\nwhen I receive [start v]\nforever\n    switch costume to ((lvl#) + (1))\nend\n\nwhen I receive [start v]\nforever\n    wait until <key (m v) pressed?>\n    show variable [level v]\n    wait until <not <key (m v) pressed?>>\n    wait until <key (m v) pressed?>\n    hide variable [level v]\n    wait until <not <key (m v) pressed?>>\nend\n\n@narrator\n\nwhen I receive [start v]\nswitch costume to (1 v)\nforever\n    switch costume to ((lvl#) + (1))\nend\n\nswitch costume to ((lvl#) + (1))\n\n
You are an adventurer from the Earth's core who strayed too far from home. You need to learn as much as you can about the Earth's layers, and get back home.\n===============CONTROLS=================\nleft and right arrow keys  - move \nup arrow key - jump\n[M] - hide/show level\n\nDouble click green flag, and if it looks like it didn't work, just WAIT. After five seconds if it doesn't work, double click flag again.