The World - Scrolling Platformer (collab)

Instructions: Arrow keys/wad/mobile to move\nAvoid dangers such as spikes, lava, and purple acid\nGet to the blue portal\nThe 6 stages are grassland, cavern, darkness, dessert, sunset, and snowy.

@Stage\n\nwhen flag clicked\nswitch backdrop to (blue sky 2  v)\nforever\n    if <(LEVEL) = [2]> then\n        wait (1) seconds\n        switch backdrop to (blue sky 2 2 v)\n    end\n    if <(LEVEL) = [3]> then\n        wait (1) seconds\n        switch backdrop to (blue sky 2 2 v)\n    end\n    if <(LEVEL) = [4]> then\n        wait (1) seconds\n        switch backdrop to (blue sky 2  v)\n    end\n    if <(LEVEL) = [6]> then\n        wait (1) seconds\n        switch backdrop to (blue sky 2 3 v)\n    end\n    if <(LEVEL) = [7]> then\n        wait (1) seconds\n        switch backdrop to (blue sky 2  v)\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [Travel The Galaxy \(HD\) v] until done\nend\n\n@player\n\nwhen flag clicked\nbroadcast (green flag v) and wait\nbroadcast (playgame v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [playgame v]\nset [level v] to [1]\nforever\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) and wait\n    end\n    if <(EXIT) = [win]> then\n        win\n    end\nend\n\ndefine Game on\nset [exit v] to []\nset [sy v] to [0]\nset [in air v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\ndefine Tick\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    Change PlayerX by [-8]\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    Change PlayerX by [8]\nend\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>> then\n    if <[2] > (in air)> then\n        change [sy v] by (12)\n    end\nend\nchange [sy v] by (-2)\nChange PlayerY by (sy)\nset [scroll x v] to (x)\nif <[0] > (SCROLL X)> then\n    set [scroll x v] to [0]\nend\nif <[0] > (SCROLL Y)> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-150]> then\n    set [exit v] to [die]\nend\n\ndefine Change PlayerX by (sx)\nchange [x v] by (sx)\nPosition\nTest dying\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    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 Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine Change PlayerY by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nTest dying\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\nchange [y v] by (1)\nPosition\n\ndefine Test dying\nif <touching (danger v)?> then\n    if <not <(username) = [sceptile100]>> then\n        set [exit v] to [die]\n    end\nend\n\ndefine win\nrepeat (10)\n    change [ghost v] effect by (10)\n    change size by (-10)\nend\nchange [level v] by (1)\nhide\nwait (1) seconds\n\n@platforms\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\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 [green flag v]\nhide\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 receive [setup v]\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]\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: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [360] y: [0]\n                Clone at x: [360] y: [0]\n                Clone at x: [360] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Clone at x: [360] y: [0]\n                    Clone at x: [360] y: [0]\n                    Clone at x: [360] y: [0]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (level 6 1 v)\n                        Clone at x: [360] y: [0]\n                        Clone at x: [360] y: [0]\n                        Clone at x: [360] y: [0]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (level end v)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\n@thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nset [ghost v] effect to (100)\n\n@danger\n\nwhen I receive [tick v]\nposition ((X) - (SCROLL X)) ((Y) - (SCROLL Y))\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 [green flag v]\nhide\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 receive [setup v]\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]\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: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [360] y: [0]\n                Clone at x: [360] y: [0]\n                Clone at x: [360] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Clone at x: [360] y: [0]\n                    Clone at x: [360] y: [0]\n                    Clone at x: [360] y: [0]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (level 6 1 v)\n                        Clone at x: [360] y: [0]\n                        Clone at x: [360] y: [0]\n                        Clone at x: [360] y: [0]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (level end v)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\n@exit portal\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    set [exit v] to [win]\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 [green flag v]\nhide\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 receive [setup v]\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]\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: [360] y: [0]\n        Clone at x: [360] y: [0]\n        Clone at x: [360] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n        else\n            if <(LEVEL) = [4]> then\n                switch costume to (level 4 1 v)\n                Clone at x: [360] y: [0]\n                Clone at x: [360] y: [0]\n                Clone at x: [360] y: [0]\n            else\n                if <(LEVEL) = [5]> then\n                    switch costume to (level 5 1 v)\n                    Clone at x: [360] y: [0]\n                    Clone at x: [360] y: [0]\n                    Clone at x: [360] y: [0]\n                else\n                    if <(LEVEL) = [6]> then\n                        switch costume to (level 6 1 v)\n                        Clone at x: [360] y: [0]\n                        Clone at x: [360] y: [0]\n                        Clone at x: [360] y: [0]\n                    else\n                        if <(LEVEL) = [7]> then\n                            switch costume to (level end v)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\n@decorations\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\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 [green flag v]\nhide\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 receive [setup v]\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]\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: [360] y: [0]\n        Clone at x: [360] y: [0]\n    else\n        if <(LEVEL) = [3]> then\n            switch costume to (level 3 1 v)\n            Clone at x: [360] y: [0]\n            Clone at x: [360] y: [0]\n        end\n    end\nend\n\nClone at x: [360] y: [0]\n\n@Sprite1\n\nwhen flag clicked\nhide\nforever\n    if <(LEVEL) = [3]> then\n        wait (1) seconds\n        show\n    else\n        if <(LEVEL) = [4]> then\n            wait (1) seconds\n            hide\n        else\n            hide\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    go to (player v)\nend\n\n@Sprite2\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\nswitch costume to (costume1 v)\nset [ghost v] effect to (pick random (10) to (90))\nset size to (pick random (50) to (100)) %\ngo to (random position v)\nset y to (300)\npoint in direction (180)\nrepeat until <touching (platforms v)?>\n    change [ym v] by (1)\n    move (ym) steps\nend\nhide\n\nwhen flag clicked\nforever\n    if <(LEVEL) = [6]> then\n        wait (.1) seconds\n        create clone of (_myself_ v)\n    end\nend\n\n