Simple | Scrolling Platformer


@Stage\n\nwhen flag clicked\nforever\n    play sound [Tokyo Machine - OKAY \[Monstercat Release\].mp3 v] until done\n    play sound [Tobu - Candyland v] until done\nend\n\nwhen I receive [outro v]\nstop [other scripts in sprite v]\n\nwhen flag clicked\nset [volume \(mute/unmute\) v] to [100]\nset volume to (volume \(mute/unmute\)) %\nforever\n    if <<key (m v) pressed?> and <(volume \(mute/unmute\)) = [100]>> then\n        set [volume \(mute/unmute\) v] to [0]\n        wait (.1) seconds\n    else\n        if <key (m v) pressed?> then\n            set [volume \(mute/unmute\) v] to [100]\n            wait (.1) seconds\n        end\n    end\n    set volume to (volume \(mute/unmute\)) %\nend\n\n@sensing\n\nwhen flag clicked\ngo to x: (400) y: (285)\nshow\nset [ghost v] effect to (100)\ngo [backward v] (2) layers\nsupersize me to (200)\nset [level v] to [1]\nset [y v] to [0]\nset [x v] to [0]\nforever\n    if <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < ([x position v] of [player v])>>> then\n        change [x v] by (1)\n    end\n    if <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > ([x position v] of [player v])>>> then\n        change [x v] by (-1)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (player v)?> then\n        change y by (-1)\n        if <touching (player v)?> then\n            change y by (-1)\n            if <touching (player v)?> then\n                change y by (-1)\n                if <touching (player v)?> then\n                    change y by (-1)\n                    if <touching (player v)?> then\n                        change y by (-1)\n                        if <touching (player v)?> then\n                            change y by (-1)\n                            if <touching (player v)?> then\n                                change y by (-1)\n                                if <touching (player v)?> then\n                                    change x by ((x) * (-1))\n                                    change y by (7)\n                                    if <<key (up arrow v) pressed?> or <<mouse down?> and <((mouse y) - ([y position v] of [player v])) > [50]>>> then\n                                        if <(x) > [0]> then\n                                            set [x v] to [-5]\n                                        else\n                                            set [x v] to [5]\n                                        end\n                                        set [y v] to [-10]\n                                    else\n                                        set [x v] to [0]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y v] by (1)\n    change y by (y)\n    if <touching (player v)?> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (1)\n    if <touching (player v)?> then\n        if <<key (up arrow v) pressed?> or <<mouse down?> and <((mouse y) - ([y position v] of [player v])) > [50]>>> then\n            set [y v] to [-10]\n        end\n    end\n    change y by (-1)\nend\n\nwhen I receive [i died v]\ngo to x: (400) y: (285)\n\ndefine supersize me to (*really big*)\nswitch costume to (dot v)\nset size to (*really big*) %\nswitch costume to (level 1 hitbox v)\n\nwhen I receive [next level v]\nif <(level) = [5]> then\n    broadcast (end v)\nelse\n    switch costume to (join [level ] (join (level) [ hitbox]))\n    go to x: (400) y: (285)\nend\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@ground\n\nwhen I receive [next level v]\nswitch costume to (join [level ] (level))\ngo to x: (400) y: (285)\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen flag clicked\ngo to x: (0) y: (0)\nsupersize me to (200)\nshow\nset [ghost v] effect to (0)\ngo [backward v] (0) layers\nforever\n    go to (sensing v)\nend\n\ndefine supersize me to (*really big*)\nswitch costume to (dot v)\nset size to (*really big*) %\nswitch costume to (level 1 v)\n\n@bg\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen flag clicked\ngo to x: (0) y: (0)\nsupersize me to (200)\nshow\ngo [backward v] (100) layers\nforever\n    go to (sensing v)\nend\n\ndefine supersize me to (*really big*)\nswitch costume to (dot v)\nset size to (*really big*) %\nswitch costume to (background v)\n\n@player\n\nwhen flag clicked\nshow\nset size to (100) %\nswitch costume to (player v)\ngo to x: (0) y: (0)\nset rotation style [left-right v]\npoint in direction (90)\nforever\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n    end\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n    end\n    if <touching color (#0a0a0a)?> then\n        broadcast (i died v)\n    end\n    if <touching color (#41c4ff)?> then\n        broadcast (next level v)\n        change [level v] by (1)\n    end\nend\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@on death\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\n\nwhen I receive [i died v]\nset [ghost v] effect to (0)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\n@end\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [end v]\nshow\n\n@thumbnail\n\nwhen [timer v] > (0.1)\ngo to x: (0) y: (300)\nshow\nstart sound [OOF v]\nglide (0.5) secs to x: (0) y: (0)\n\nswitch costume to (thumbnail v)\nshow\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (stop v)\ngo to [front v] layer\nhide\nforever\n    reset timer\nend\n\n