Pixel world - a scrolling platformer

Instructions: ------------------------  Pixel World  ------------------------\n\nHelp? To move use WASD or arrow keys and if you want to use mobile press and drag. Don't touch the red spikes or fall of the platform or you will die. Get to the end and jump into the light circle. The higher the level the harder it gets. \n\nYou should probable click the green flag after each level, Why not Love? :D this game took 25 hours of almost non stop work to complete so ya.\n\nWho else sat their and listened to the menu music instead of actually playing the game? comment down below!\n\nCredit train:\n@Thepugmen: sprites, code, and a ton of other things\nDimrain47 for all music\n\nFollow my studio: https://scratch.mit.edu/studios/5214316/\n\n\n\n---------------------------------------------------------------\n#game #Game #GAME #Fun #FUN #happy #HAPPY #GRASS #grass #unstoppable #project #Thepugmen #Play #platfomer #Platfomer #Mobile #Mobilefrendly #LOVE #Favrote #Now #trending #dimrain47 #Music #Art #Animation #Games #Scratch #Dodge #Ar #Music #Enemy #Enemies #Space #Orange #Playing #Dodging #Play #Square #Cube #Thumbnail #Colors  #Cool #Awesome #Good #Great #Walking #Moving #Comment #Sequel #Difficulty #Wave #Easy #Normal #Hard #Animations #All  #Art #Music #Stories #Tutorials

@Stage\n\nwhen I receive [menu v]\nswitch backdrop to (level 1 v)\n\n@Player\n\nwhen I receive [transition out v]\nshow\nforever\n    scroll ph [5]\nend\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (level hitbox 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 [speed y v] to [0]\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (level hitbox 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))\nend\n\ndefine scroll ph (speed)\nswitch costume to (hitbox v)\nif <<(speed y) < [4]> or <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n    change [speed y v] by (-1)\nelse\n    change [speed y v] by (-2)\nend\nchange y by (speed y)\nTouch Ground <(speed y) > [0]>\nif <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    Walk (-90) ((speed) * (-1))\nelse\n    if <<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        Walk (90) (speed)\n    end\nend\nif <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    if <<(jump key) = [0]> and <(falling?) < [3]>> then\n        start sound [jump v]\n        set [speed y v] to [14]\n        set [falling? v] to [6]\n        set [jump key v] to [1]\n    end\nelse\n    set [jump key v] to [0]\nend\nif <<(y position) = [-180]> or <touching (pain v)?>> then\n    go to x: (0) y: (0)\n    start sound [Crunch v]\n    point in direction (90)\n    set [scrollx v] to [-170]\n    set [speed y v] to [0]\nend\nScrolling Blocks\nif <(level) = [6]> then\n    switch costume to (hitbox v)\nelse\n    switch costume to (player v)\nend\n\ndefine Reset Player\nshow\nset size to (100) %\nset rotation style [left-right v]\npoint in direction (90)\ngo to x: (0) y: (100)\nset [speed y v] to [0]\nset [falling? v] to [10]\nset [scrollx v] to [-150]\nhide\n\ndefine Scrolling Blocks\nchange [scrollx v] by (x position)\nset x to (0)\n\nwhen flag clicked\nhide\n\nwhen I receive [setup v]\nReset Player\n\nwhen I receive [finish v]\nhide\nstop [other scripts in sprite v]\nbroadcast (menu v)\n\nwhen I receive [play v]\nbroadcast (Transition In v) and wait\nbroadcast (Delete All Clones v) and wait\nbroadcast (SetUp v) and wait\nbroadcast (Level Loop v)\nbroadcast (Transition Out v) and wait\n\nwhen I receive [level 6 v]\nforever\n    switch costume to (hitbox v)\nend\n\n@Level HITBOX\n\ndefine Create\nwait (1) seconds\nrepeat (4)\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    change [levelx v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nset [levelx v] to [0]\nCreate\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [level 1 v]\nswitch costume to ((1) / (1))\n\nwhen I receive [level 2 v]\nswitch costume to (level 1 pt 2 v)\n\nwhen I receive [finish v]\ndelete this clone\n\nwhen I receive [level 3 v]\nswitch costume to (level 1 pt 3 v)\n\nwhen I receive [finish v]\ndelete this clone\n\nwhen I receive [level 4 v]\nswitch costume to (level 1 pt 4 v)\n\n@Level deco\n\ndefine Create\nwait (1) seconds\nrepeat (4)\n    create clone of (_myself_ v)\n    change [lx v] by (480)\n    change [x v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Lx) - (ScrollX))\n    if <([abs v] of ((Lx) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\nclear graphic effects\ngo to x: (0) y: (0)\nset [lx v] to [0]\nset [x v] to [0]\nCreate\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [level 1 v]\nswitch costume to ((1) / (1))\n\nwhen I receive [level 2 v]\nswitch costume to (level 1 pt 2 v)\n\nwhen I receive [finish v]\ndelete this clone\n\nwhen I receive [level 3 v]\nswitch costume to (level 1 pt 3 v)\n\nwhen I receive [finish v]\ndelete this clone\n\nwhen I receive [level 4 v]\nswitch costume to (level 1 pt 4 v)\n\n@pain\n\ndefine Create\nwait (1) seconds\nrepeat (4)\n    create clone of (_myself_ v)\n    change [lx v] by (480)\n    change [levelx_public v] by (480)\n    next costume\nend\n\nwhen I receive [level loop v]\nforever\n    set x to ((Lx) - (ScrollX))\n    if <([abs v] of ((Lx) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [lx v] to [0]\nset [levelx_public v] to [0]\nCreate\nhide\n\nwhen I receive [level 2 v]\nswitch costume to (level 1 pt 2 v)\n\nwhen I receive [level 1 v]\nswitch costume to ((1) / (1))\n\nwhen I receive [menu v]\ndelete this clone\n\nwhen I receive [level 3 v]\nswitch costume to (level 1 pt 3 v)\n\nwhen I receive [finish v]\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I receive [level 4 v]\nswitch costume to (level 1 pt 4 v)\n\n@Win\n\nwhen I receive [level 1 v]\nclear graphic effects\nswitch costume to (costume1 v)\nset [lo win x v] to [2100]\nset [lo win y v] to [0]\n\nwhen flag clicked\nclear graphic effects\nhide\n\ndefine set x to (number1) (number2) set y to (number3)\ngo to [front v] layer\nforever\n    if <<(ScrollX) > ((number1) - (960))> or <((number1) + (960)) > (ScrollX)>> then\n        switch costume to (costume1 v)\n        set x to ((0) - ((ScrollX) + ((0) - (number1))))\n        switch costume to (number2)\n    end\nend\n\nwhen I receive [play v]\nforever\n    set y to (Y win)\n    if <touching (player v)?> then\n        stop [other scripts in sprite v]\n        go to x: (0) y: (0)\n        repeat (10)\n            change [ghost v] effect by (10)\n            change y by (-1)\n        end\n        broadcast (finish v)\n        delete this clone\n    end\nend\n\nwhen I receive [level 2 v]\nclear graphic effects\nswitch costume to (costume1 v)\nset [lo win x v] to [2115]\nset [lo win y v] to [0]\n\nwhen I receive [level 3 v]\nclear graphic effects\nswitch costume to (costume1 v)\nset [lo win x v] to [2135]\nset [lo win y v] to [-55]\n\nwhen I receive [menu v]\nhide\n\nwhen I receive [play v]\nset [x win v] to (LO win X)\nset [y win v] to (LO win Y)\nset x to (X win) (costume [number v]) set y to (Y win)\n\nwhen I receive [level 4 v]\nclear graphic effects\nswitch costume to (costume1 v)\nset [lo win x v] to [2135]\nset [lo win y v] to [0]\n\nwhen I receive [play v]\nforever\n    if <([abs v] of ((levelx) - (ScrollX)) ) > [200]> then\n        show\n    else\n        hide\n    end\nend\n\n@introduction \n\nwhen flag clicked\nwait (2.9) seconds\nforever\n    repeat (10)\n        change size by (3)\n    end\n    repeat (3)\n        change size by (-3)\n    end\nend\n\nwhen I receive [the end :\) v]\ngo to x: (0) y: (100)\nswitch costume to (costume40 v)\npoint in direction (90)\nset size to (4) %\ngo to [front v] layer\nshow\nrepeat (25)\n    change size by (4)\n    turn right (14.4) degrees\nend\nset size to (100) %\n\nwhen I receive [menu v]\nswitch costume to (costume2 v)\ngo to [front v] layer\nhide\n\ndefine intro\ngo to [front v] layer\ngo to [front v] layer\nshow\nstart sound [intro song v]\nrepeat until <(costume [number v]) = [16]>\n    next costume\nend\nswitch costume to (costume17 v)\nrepeat until <(costume [number v]) = [32]>\n    wait (.0003) seconds\n    next costume\nend\nswitch costume to (costume33 v)\nrepeat until <(costume [number v]) = [38]>\n    wait (.0003) seconds\n    next costume\nend\nwait (6) seconds\nbroadcast (menu v)\nhide\nstop [other scripts in sprite v]\n\nwhen flag clicked\nchange [pixelate v] effect by (50)\nswitch costume to (costume2 v)\ngo to x: (0) y: (0)\npoint in direction (90)\nset size to (100) %\nintro\n\nwhen flag clicked\nforever\n    if <key (space v) pressed?> then\n        stop all sounds\n        stop [other scripts in sprite v]\n        broadcast (menu v)\n        hide\n        stop [this script v]\n    end\nend\n\n@thumbnail\n\nwhen flag clicked\nhide\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.1)\nbroadcast (stop v)\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\n@menu\n\nwhen I receive [menu v]\ncreate clone of (_myself_ v)\nset [id v] to [1]\ncreate clone of (_myself_ v)\nset [id v] to [2]\ncreate clone of (_myself_ v)\nset [id v] to [3]\ncreate clone of (_myself_ v)\nset [id v] to [4]\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\nif <(id) = [1]> then\n    Go to [135] [5]\n    switch costume to (start v)\n    go to [front v] layer\n    forever\n        point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n        if <touching (mouse-pointer v)?> then\n            change size by (((120) - (size)) / (3))\n            set [ghost v] effect to (20)\n            if <mouse down?> then\n                wait (.1) seconds\n                broadcast (level select  v)\n                delete this clone\n            end\n        else\n            change size by (((100) - (size)) / (3))\n            set [ghost v] effect to (0)\n        end\n    end\nend\nif <(id) = [2]> then\n    Go to [135] [-115]\n    switch costume to (help v)\n    go to [front v] layer\n    forever\n        point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n        if <touching (mouse-pointer v)?> then\n            change size by (((120) - (size)) / (3))\n            set [ghost v] effect to (20)\n            if <mouse down?> then\n                broadcast (help v)\n                delete this clone\n            end\n        else\n            change size by (((100) - (size)) / (3))\n            set [ghost v] effect to (0)\n        end\n    end\nend\nif <(id) = [3]> then\n    Go to [0] [120]\n    switch costume to (title v)\n    go to [front v] layer\n    forever\n        point in direction (([cos v] of ((timer) * (1000)) ) + (90))\n    end\nend\nif <(id) = [4]> then\n    go to [front v] layer\n    Go to [0] [0]\n    switch costume to (back v)\nend\n\nwhen I receive [transition out v]\ndelete this clone\n\nwhen I receive [play v]\ndelete this clone\n\ndefine Go to (x) (y)\ngo to x: (x) y: (y)\n\nwhen I receive [level select  v]\ndelete this clone\n\nwhen I receive [level select  v]\nwait (0.00000001) seconds\ncreate clone of (_myself_ v)\nset [id v] to [4]\n\nwhen I receive [help v]\ndelete this clone\n\nwhen flag clicked\nwait (.01) seconds\nforever\n    wait (.02) seconds\n    change [timer v] by (1)\nend\n\n@back\n\nwhen I receive [level select  v]\nshow\ngo to x: (-150) y: (-137)\nforever\n    go to [front v] layer\n    point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n    if <touching (mouse-pointer v)?> then\n        change size by (((100) - (size)) / (3))\n        set [ghost v] effect to (20)\n        if <mouse down?> then\n            wait (.1) seconds\n            broadcast (menu v)\n            delete this clone\n        end\n    else\n        change size by (((75) - (size)) / (3))\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen I receive [help v]\nshow\ngo to x: (124) y: (6)\nforever\n    go to [front v] layer\n    point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n    if <touching (mouse-pointer v)?> then\n        change size by (((100) - (size)) / (3))\n        set [ghost v] effect to (20)\n        if <mouse down?> then\n            wait (.1) seconds\n            broadcast (menu v)\n            delete this clone\n        end\n    else\n        change size by (((75) - (size)) / (3))\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen I receive [menu v]\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nstop [other scripts in sprite v]\nhide\n\n@select\n\nwhen I receive [level select  v]\nswitch costume to (plains v)\ngo to x: (0) y: (0)\nshow\nforever\n    go to [front v] layer\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (3))\n        set [ghost v] effect to (20)\n        point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n        if <mouse down?> then\n            wait (.1) seconds\n            if <(level) = [1]> then\n                switch backdrop to (level 1 v)\n                broadcast (level 1 v)\n                broadcast (Play v)\n            end\n            if <(level) = [2]> then\n                broadcast (level 2 v)\n                broadcast (Play v)\n                switch backdrop to (level 2 v)\n            end\n            if <(level) = [3]> then\n                broadcast (level 3 v)\n                broadcast (Play v)\n                switch backdrop to (level 3 v)\n            end\n            if <(level) = [4]> then\n                broadcast (level 4 v)\n                broadcast (Play v)\n                switch backdrop to (level 4 v)\n            end\n        end\n    else\n        change size by (((100) - (size)) / (3))\n        set [ghost v] effect to (0)\n        point in direction (90)\n    end\nend\n\nwhen I receive [back lv v]\nif <not <(costume [number v]) = [1]>> then\n    switch costume to ((costume [number v]) - (1))\n    change [level v] by (-1)\nend\n\nwhen I receive [next lv v]\nif <not <(costume [number v]) = [5]>> then\n    next costume\n    change [level v] by (1)\nend\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\nset [level v] to [1]\n\nwhen I receive [menu v]\nhide\n\nwhen I receive [play v]\nstop [other scripts in sprite v]\nhide\n\n@level buttons\n\nwhen I start as a clone\nshow\nif <(id) = [1]> then\n    set x to (180)\n    forever\n        go to [front v] layer\n        switch costume to (right buttion v)\n        if <touching (mouse-pointer v)?> then\n            change size by (((120) - (size)) / (3))\n            set [ghost v] effect to (20)\n            point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n            if <mouse down?> then\n                wait (.1) seconds\n                broadcast (next lv v)\n            end\n        else\n            change size by (((100) - (size)) / (3))\n            set [ghost v] effect to (0)\n            point in direction (90)\n        end\n    end\nend\nif <(id) = [2]> then\n    set x to (-180)\n    forever\n        go to [front v] layer\n        switch costume to (left buttion v)\n        if <touching (mouse-pointer v)?> then\n            change size by (((120) - (size)) / (3))\n            set [ghost v] effect to (20)\n            point in direction (([sin v] of ((timer) * (1000)) ) + (90))\n            if <mouse down?> then\n                wait (.1) seconds\n                broadcast (back lv v)\n            end\n        else\n            change size by (((100) - (size)) / (3))\n            set [ghost v] effect to (0)\n            point in direction (90)\n        end\n    end\nend\n\nwhen I receive [level select  v]\ncreate clone of (_myself_ v)\nset [id v] to [1]\ncreate clone of (_myself_ v)\nset [id v] to [2]\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\ndelete this clone\n\nwhen I receive [play v]\ndelete this clone\n\n@Transition\n\nwhen I start as a clone\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nhide\ngo to [front v] layer\nshow\nstart sound [Disconnect v]\nrepeat (16)\n    next costume\nend\nwait (1) seconds\nswitch costume to (costume17 v)\nstart sound [Connect v]\nrepeat (16)\n    switch costume to ((costume [number v]) - (1))\nend\ndelete this clone\n\nwhen I receive [transition in v]\ngo to x: (0) y: (0)\ncreate clone of (_myself_ v)\n\n@Help\n\nwhen I receive [help v]\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\nwhen flag clicked\nhide\n\nwhen I receive [menu v]\nhide\n\n@music\n\nwhen I receive [menu v]\nset volume to (500) %\nstop [other scripts in sprite v]\nforever\n    play sound [menu v] until done\nend\n\nwhen I receive [play v]\nstop [other scripts in sprite v]\nclear sound effects\nstop all sounds\nset volume to (100) %\nwait (1) seconds\nforever\n    if <(level) = [1]> then\n        play sound [music game v] until done\n    else\n        if <(level) = [2]> then\n            play sound [music game 2 v] until done\n        else\n            if <(level) = [3]> then\n                play sound [music game 3 v] until done\n            else\n                if <(level) = [4]> then\n                    play sound [music game 4 v] until done\n                end\n            end\n        end\n    end\nend\n\n@thing\n\nwhen I receive [play v]\nshow\n\nwhen I receive [menu v]\nhide\n\nwhen flag clicked\nhide\n\n