Lavalands-A Mobile Scrolling Platformer

Instructions: Long go the earth was covered with grassy plains. But a super volcano exploded,resulting in many miles of ash. This became the lava lands.\nwasd more arrow keys or mobile to move\nGet to the portal.\nOne easter egg.\nMy other scrolling platformers:\nlava cave: https://scratch.mit.edu/projects/399541578/\ngrassy: https://scratch.mit.edu/projects/399664253

@Stage\n\n@Platforms\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [500] y: [0]\n    Clone at x: [800] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [200] y: [0]\n        Clone at x: [200] y: [0]\n        Clone at x: [200] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (3 v)\n            Clone at x: [500] y: [0]\n            Clone at x: [500] y: [0]\n            Clone at x: [500] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 v)\n                Clone at x: [900] y: [0]\n                Clone at x: [650] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 5 v)\n                    Clone at x: [400] y: [0]\n                    Clone at x: [400] y: [0]\n                    Clone at x: [400] y: [0]\n                    Clone at x: [400] y: [0]\n                    Clone at x: [400] y: [0]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (level 6 acural 6 v)\n                        Clone at x: [600] y: [400]\n                        Clone at x: [600] y: [-100]\n                        Clone at x: [600] y: [0]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (level 7 acural 5 v)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nnext costume\nnext costume\n\ncreate clone of (_myself_ v)\n\nClone at x: [400] y: [0]\nClone at x: [400] y: [0]\nClone at x: [400] y: [0]\nClone at x: [400] y: [0]\n\nClone at x: [600] y: [400]\nClone at x: [600] y: [-100]\nClone at x: [600] y: [0]\n\nglide (1) secs to (random position v)\n\n@Exit\n\nwhen I receive [green flag v]\nhide\n\nshow\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <<touching (player v)?> and <(portal open?) = [1]>> then\n    set [exit v] to [win]\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [portal open? v] to [1]\nif <(LEVEL) = [1]> then\n    Clone at x: [1200] y: [150]\nelse\n    if <(LEVEL) = [2]> then\n        Clone at x: [1200] y: [100]\n    else\n        if <(LEVEL) = [3]> then\n            Clone at x: [2000] y: [265]\n        else\n            if <(LEVEL) = [4]> then\n                Clone at x: [2150] y: [100]\n            else\n                if <(LEVEL) = [5]> then\n                    Clone at x: [2400] y: [50]\n                else\n                    if <(LEVEL) = [6]> then\n                        Clone at x: [2300] y: [400]\n                    else\n                        if <(LEVEL) = [7]> then\n                            Clone at x: [2300] y: [400]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nClone at x: [920] y: [-28]\n\ncreate clone of (_myself_ v)\n\nnext costume\nnext costume\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\n\nwhen I receive [open portal v]\nset [brightness v] effect to (5)\nset [ghost v] effect to (0)\nset [portal open? v] to [1]\n\nhide\n\nswitch costume to (open v)\n\nwhen flag clicked\nforever\n    next costume\nend\n\nif <(LEVEL) = [2]> then\n    set [portal open? v] to [0]\n    set [ghost v] effect to (40)\n    set [brightness v] effect to (-40)\n    switch costume to (closed v)\n    Clone at x: [600] y: [0]\nelse\n    if <(LEVEL) = [3]> then\n        set [portal open? v] to [0]\n        switch costume to (closed v)\n        set [ghost v] effect to (40)\n        set [brightness v] effect to (-40)\n    else\n        if <(LEVEL) = [4]> then\n            set [portal open? v] to [0]\n            set [brightness v] effect to (-40)\n            set [ghost v] effect to (40)\n            Clone at x: [-190] y: [200]\n        else\n            if <(LEVEL) = [5]> then\n                set [portal open? v] to [0]\n                set [brightness v] effect to (-40)\n                set [ghost v] effect to (40)\n                Clone at x: [-190] y: [200]\n            end\n        end\n    end\nend\n\nClone at x: [350] y: [100]\n\nset [portal open? v] to [0]\nset [brightness v] effect to (-40)\nswitch costume to (closed v)\n\nif <(LEVEL) = [7]> then\n\nClone at x: [2000] y: [100]\n\n@DANGER\n\nwhen I receive [green flag v]\nhide\n\nshow\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [630] y: [-30]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 v)\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (4 v)\n                Clone at x: [1800] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (costume1 v)\n                    Clone at x: [2000] y: [-100]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (6 v)\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (7 v)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: ((y) + (lava rise))\nif <<(x) = (x position)> and <((y) + (lava rise)) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I start as a clone\nforever\n\nchange y by (-10)\n\nwait (0.1) seconds\n\nchange y by (10)\n\nset [scroll y v] to [10]\n\nwhen flag clicked\nset [lava rise v] to [5]\nforever\n    repeat (5)\n        change [lava rise v] by (2)\n    end\n    wait (0.1) seconds\n    repeat (5)\n        change [lava rise v] by (-2)\n    end\n    wait (0.1) seconds\nend\n\nwait (0.01) seconds\n\nwait (0.01) seconds\n\nClone at x: [2000] y: [-100]\n\n@DANGER2\n\nwhen I receive [green flag v]\nhide\n\nshow\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    Clone at x: [360] y: [0]\n    Clone at x: [360] y: [0]\nelse\n    if <(LEVEL) = [2]> then\n        switch costume to (level 2 1 v)\n        Clone at x: [630] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 v)\n            Clone at x: [900] y: [0]\n            Clone at x: [900] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (4 v)\n                Clone at x: [500] y: [0]\n                Clone at x: [500] y: [0]\n                Clone at x: [500] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (5 v)\n                    Clone at x: [500] y: [0]\n                    Clone at x: [500] y: [0]\n                    Clone at x: [500] y: [0]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (6 v)\n                        Clone at x: [500] y: [200]\n                        Clone at x: [500] y: [50]\n                        Clone at x: [500] y: [0]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (7 v)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I start as a clone\nforever\n\nchange y by (10)\n\nchange y by (-10)\n\nwait (0.1) seconds\n\nset [scroll y v] to [10]\n\nwhen flag clicked\nset [lava rise v] to [5]\n\nrepeat (5)\n    change [lava rise v] by (2)\nend\nwait (0.1) seconds\nrepeat (5)\n    change [lava rise v] by (-2)\nend\nwait (0.1) seconds\n\nforever\n\nClone at x: [500] y: [0]\n\nClone at x: [500] y: [0]\nClone at x: [500] y: [0]\n\nClone at x: [50] y: [50]\n\n@Player\n\nwhen flag clicked\nhide\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\nwait (4) seconds\nshow\n\nwhen I receive [green flag v]\n\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    show\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Game On\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v)\n    end\n    if <(EXIT) = [win]> then\n        Game - Win\n    else\n        Game - Die\n    end\nend\n\ndefine Game On\nset [y v] to [0]\nset [x v] to [0]\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset [ghost v] effect to (0)\nset size to (100) %\n\nshow\n\ndefine Tick\nif <<<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <(left) = [1]>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [sx v] by (-2)\n    switch costume to (costume2 v)\nend\nif <<<mouse down?> and <(x position) < (mouse x)>> or <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <(right) = [1]>>> then\n    change [sx v] by (2)\n    switch costume to (costume1 v)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player x by (round (sx))\nend\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <(up) = [1]>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange Player y by (sy)\nTest - Die\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (10)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <(up) = [1]>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (platforms v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Game - Die\nset [exit v] to []\nhide\nbroadcast (die v)\nwait until <(respawn) = [1]>\nwait (0.5) seconds\nhide\n\nrepeat (5)\n    hide\n    wait (.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.5) seconds\n\ndefine Test - Die\nif <<touching (danger v)?> or <touching (danger2 v)?>> then\n    set [exit v] to [die]\nend\n\ndefine Game - Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level v] by (1)\npoint in direction (90)\nwait (1) seconds\n\ndefine Walk\n\nwhen I receive [walk v]\n\n\n\n\nwhen I receive [walk v]\n\nwhen flag clicked\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\nend\n\n\n\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n    if <[3] < (costume [number v])> then\n        wait (0.1) seconds\n        next costume\n    else\n        switch costume to (walk 1 v)\n    end\nelse\n    switch costume to (idle v)\nend\n\nwhen flag clicked\nhide\n\nturn right (15) degrees\n\nbroadcast (Tick v) and wait\n\nbroadcast (Tick v) and wait\n\nwhen flag clicked\npoint in direction (90)\n\nwhen flag clicked\nwait (4) seconds\nforever\n    play sound [Magical-Discovery v] until done\nend\n\n@Sprite1\n\nwhen flag clicked\nrepeat (100)\n    change [ghost v] effect by (1)\nend\n\nchange [pixelate v] effect by (1)\n\nwait (0.1) seconds\n\n@Sprite2\n\nwhen flag clicked\nforever\nend\n\nwait (0.1) seconds\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\n\nshow\n\nset [color v] effect to (pick random (1) to (30))\nset [ghost v] effect to (pick random (10) to (50))\ngo to x: (pick random (-200) to (200)) y: (-300)\nglide (1) secs to x: (pick random ((x position) + (-50)) to ((x position) + (50))) y: (pick random (-50) to (100))\nglide (1) secs to x: (pick random ((x position) + (-50)) to ((x position) + (50))) y: (-180)\ndelete this clone\n\nwhen I start as a clone\nforever\nend\n\ngo to x: (36) y: (-181)\n\n@Sprite3\n\nwhen flag clicked\nforever\nend\n\nwait (1) seconds\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\n\nif <(pick random (1) to (2)) = [1]> then\n    go to x: (-300) y: (pick random (0) to (50))\n    repeat (75)\n        change x by (10)\n    end\nelse\n    go to x: (300) y: (pick random (0) to (50))\n    repeat (75)\n        change x by (-10)\n    end\nend\ndelete this clone\n\nshow\n\n@letters on intro\n\nwhen flag clicked\nhide\nwait (2) seconds\nshow\ngo to [front v] layer\nwait (0.5) seconds\ncreate clone of (_myself_ v)\nwait (3) seconds\nhide\n\nwhen I start as a clone\nswitch costume to (costume2 v)\nwait (3) seconds\nhide\n\n@intro\n\nwhen flag clicked\nhide\nwait (0.8) seconds\nshow\nswitch costume to (gsssrfvjuzkvmxmemyjyj5 v)\nrepeat (36)\n    next costume\n    wait (0.1) seconds\nend\nhide\n\n@Sprite4\n\nwhen I receive [die v]\nswitch costume to ([costume # v] of [player v])\nshow\npoint in direction (90)\ngo to (player v)\nrepeat (10)\n    change y by (10)\n    turn right (15) degrees\nend\nrepeat until <(y position) < [-179]>\n    change y by (-10)\n    turn right (15) degrees\nend\npoint in direction (90)\nhide\nset [respawn v] to [1]\nwait (0.01) seconds\nset [respawn v] to [0]\nif <(costume [number v]) = [1]> then\nelse\nend\n\nwhen flag clicked\nhide\nset [respawn v] to [0]\n\nwait (0.01) seconds\n\nrepeat (10)\n    change y by (10)\n    turn right (-15) degrees\nend\nrepeat until <(y position) < [-179]>\n    change y by (-7)\n    turn right (-15) degrees\nend\npoint in direction (90)\nhide\nset [respawn v] to [1]\nwait (0.01) seconds\nset [respawn v] to [0]\n\n