Little Platformer Part2

Instructions: Play wirh WASD\nthe arrow keys\nor the mouse\n7 likes for part3\n\nPart1 https://scratch.mit.edu/projects/622686665\nPart3: https://scratch.mit.edu/projects/639510751\nPart4: https://scratch.mit.edu/projects/644030757

@Stage\n\nwhen flag clicked\nforever\n    play sound [song v] until done\nend\n\n@Guy\n\nwhen I start as a clone\nswitch costume to (trail1 v)\nclear graphic effects\nrepeat (8)\n    change size by (-4)\n    change [ghost v] effect by (10)\n    change [brightness v] effect by (10)\nend\ndelete this clone\n\nwhen flag clicked\nSetup\nbroadcast (Game Loop v)\n\ngo to x: (-190) y: (-24)\ngo to x: (-201) y: (14)\n\nwhen flag clicked\n\ndefine Fix Collisions in direction (dir)\nset [temporary dir v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (168)\n    Check Touching Solid\n    if <(touching) < [1]> then\n        point in direction (temporary dir)\n        stop [this script v]\n    end\n    move (distance) steps\n    turn right (180) degrees\n    change [distance v] by (1)\nend\n\ndefine Check Touching Solid\nif <touching (ground v)?> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nhide variable [x v]\n\nwhen flag clicked\nforever\n    Check Touching Solid\n    if <(touching) > [0]> then\n        Fix Collisions in direction [0]\n        Fix Collisions in direction [90]\n    end\nend\n\ndefine Setup\ngo to x: (-200) y: (50)\npoint in direction (90)\nshow\ngo to [front v] layer\nclear graphic effects\nset size to (45) %\nswitch costume to (middle v)\nset drag mode [not draggable v]\nset [x v] to [0]\nset [y v] to [0]\nset [level v] to [1]\n\ndefine Left / Right Movement\nif <<<mouse down?> and <(x position) > (mouse x)>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n    change [x v] by (-1)\nend\nif <<<mouse down?> and <(x position) < (mouse x)>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n    change [x v] by (1)\nend\nset [x v] to ((X) * (0.9))\nchange x by (X)\n\nwhen I receive [game loop v]\nforever\n    create clone of (_myself_ v)\n    Set Costume\n    Left / Right Movement\n    Horizontal Collision and Wall Jump\n    Up / Down Movement\n    Check Death / Win\nend\n\ndefine Horizontal Collision and Wall Jump\nCheck Touching Solid\nif <(touching) = [1]> then\n    change y by (1)\n    Check Touching Solid\n    if <(touching) = [1]> then\n        change y by (1)\n        Check Touching Solid\n        if <(touching) = [1]> then\n            change y by (1)\n            Check Touching Solid\n            if <(touching) = [1]> then\n                change y by (1)\n                Check Touching Solid\n                if <(touching) = [1]> then\n                    change y by (1)\n                    Check Touching Solid\n                    if <(touching) = [1]> then\n                        change x by ((X) * (-1))\n                        change y by (-5)\n                        if <<<mouse down?> and <(y position) < (mouse y)>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n                            if <(X) > [0]> then\n                                set [x v] to [-7]\n                            else\n                                set [x v] to [7]\n                            end\n                            set [y v] to [14]\n                        else\n                            set [x v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange y by (-3)\n\ndefine Up / Down Movement\nCheck Touching Solid\nif <(touching) = [1]> then\n    if <<<mouse down?> and <(y position) < (mouse y)>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [y v] to [14]\n    end\nend\nchange y by (3)\nchange [y v] by (-1)\nchange y by (Y)\nCheck Touching Solid\nif <(touching) = [1]> then\n    change y by ((Y) * (-1))\n    set [y v] to [0]\nend\n\ndefine Check Death / Win\nif <(x position) > [230]> then\n    change [level v] by (1)\n    broadcast (next level v)\nend\nif <(y position) < [-170]> then\n    broadcast (Death v)\nend\nif <touching (spike v)?> then\n    broadcast (Death v)\nend\nif <touching (lava v)?> then\n    broadcast (Death v)\nend\nif <touching (saw v)?> then\n    broadcast (Death v)\nend\n\nwhen I receive [next level v]\nset [y v] to [0]\nset [x v] to [0]\ngo to x: (-245) y: (y position)\n\nwhen I receive [death v]\nstop [other scripts in sprite v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nclear graphic effects\ngo to x: (-235) y: (-50)\nset [y v] to [0]\nset [x v] to [0]\nshow\nbroadcast (Game Loop v)\ndelete this clone\n\ndefine Set Costume\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) + (-20)) > (y position)> and <mouse down?>>> and <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<((mouse x) + (15)) > (x position)> and <mouse down?>>>> then\n    switch costume to (right v)\nelse\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) + (-20)) > (y position)> and <mouse down?>>> and <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<((mouse x) - (15)) < (x position)> and <mouse down?>>>> then\n        switch costume to (left v)\n    else\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) + (-20)) > (y position)> and <mouse down?>>> then\n            switch costume to (up v)\n        else\n            if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<((mouse x) - (-20)) > (x position)> and <mouse down?>>> then\n                switch costume to (right v)\n            else\n                if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<((mouse x) + (-20)) < (x position)> and <mouse down?>>> then\n                    switch costume to (left v)\n                else\n                    switch costume to (middle v)\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [death v]\n\nwhen I receive [game loop v]\ndelete this clone\n\nwhen I receive [game loop v]\n\nFix Collisions in direction [0]\nFix Collisions in direction [90]\n\nwhen I receive [next level v]\nwait (0.01) seconds\nFix Collisions in direction [0]\n\nwhen I receive [90 v]\nset [y v] to [20]\nchange y by (Y)\n\nwhen I receive [-90 v]\nset [y v] to [-20]\nchange y by (Y)\n\nstop [this script v]\n\nwhen I receive [180 v]\nset [x v] to [25]\n\nwhen I receive [next level v]\nFix Collisions in direction [0]\n\nwhen I receive [game loop v]\nFix Collisions in direction [0]\n\n@ground\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\npoint in direction (90)\nswitch costume to (join [Level] (Level))\n\nwhen I receive [next level v]\nswitch costume to (join [Level] (Level))\n\nforever\n\nswitch costume to (level1 v)\n\nnext costume\n\n@Lava\n\nwhen I receive [next level v]\ngo to [back v] layer\ngo to x: (0) y: (0)\nif <(Level) = [3]> then\n    show\n    switch costume to (lava0 v)\n    forever\n        change [frame v] by (0.4)\n        set y to ((5) * ([sin v] of ((timer) * (150)) ))\n        switch costume to (join [lava] (([floor v] of (frame) ) mod (4)))\n    end\nend\nif <(Level) = [6]> then\n    show\n    switch costume to (lava2.0 v)\n    forever\n        change [frame v] by (0.4)\n        set y to ((5) * ([sin v] of ((timer) * (150)) ))\n        switch costume to (join [lava2.] (([floor v] of (frame) ) mod (4)))\n    end\nend\nif <(Level) = [5]> then\n    hide\nend\nif <(Level) = [4]> then\n    hide\nend\nif <(Level) = [7]> then\n    show\n    switch costume to (lava0 v)\n    forever\n        change [frame v] by (0.4)\n        set y to ((5) * ([sin v] of ((timer) * (150)) ))\n        switch costume to (join [lava] (([floor v] of (frame) ) mod (4)))\n    end\nend\nif <(Level) = [9]> then\n    hide\nend\n\nhide\n\nwhen flag clicked\nhide\n\nnext costume\n\n@Spike\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\ngo to [back v] layer\nif <(Level) = [2]> then\n    show\n    switch costume to (2 v)\n    go to x: (19) y: (0)\nend\nif <(Level) = [3]> then\n    hide\nend\nif <(Level) = [4]> then\n    show\n    switch costume to (3 v)\n    go to x: (23) y: (-38)\nend\nif <(Level) = [5]> then\n    hide\nend\nif <(Level) = [6]> then\n    hide\nend\nif <(Level) = [7]> then\n    hide\nend\nif <(Level) = [8]> then\n    show\n    switch costume to (4 v)\n    go to x: (112) y: (-46)\nend\nif <(Level) = [9]> then\n    hide\nend\n\nif <(Level) = [11]> then\n    hide\nend\nif <(Level) = [13]> then\n    show\n    switch costume to (13 v)\nend\nif <(Level) = [14]> then\n    show\n    switch costume to (14 v)\nend\nif <(Level) = [15]> then\n    show\n    switch costume to (15 v)\nend\nif <(Level) = [16]> then\n    hide\nend\nif <(Level) = [17]> then\n    show\n    switch costume to (17 v)\nend\nif <(Level) = [18]> then\n    hide\nend\n\n@Trampoline\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nwait (0) seconds\ngo to [back v] layer\nif <(Level) = [7]> then\n    show\n    go to x: (-121) y: (-85)\n    point in direction (90)\n    create clone of (_myself_ v)\n    hide\nend\n\nif <(Level) = [14]> then\n    show\n    go to x: (-179) y: (-98)\n    create clone of (_myself_ v)\nend\nhide\nhide\n\nwhen I start as a clone\nshow\nforever\n    go to [back v] layer\n    if <touching (guy v)?> then\n        switch costume to (costume1 v)\n        broadcast (direction)\n        wait (0.08) seconds\n        switch costume to (spring2 v)\n        wait (0.05) seconds\n    end\nend\n\ndefine Clone L9\ngo to x: (-174) y: (-120)\npoint in direction (90)\nrepeat (7)\n    create clone of (_myself_ v)\n    change x by (60)\nend\nchange x by (-60)\npoint in direction (-90)\nset y to (55)\nrepeat (7)\n    create clone of (_myself_ v)\n    change x by (-60)\nend\nhide\n\nwhen I receive [next level v]\ndelete this clone\n\ndefine Clone L12\npoint in direction (90)\ngo to x: (-197) y: (-106)\ncreate clone of (_myself_ v)\npoint in direction (180)\ngo to x: (-209) y: (93)\ncreate clone of (_myself_ v)\npoint in direction (-90)\ngo to x: (-50) y: (130)\ncreate clone of (_myself_ v)\npoint in direction (180)\ngo to x: (0) y: (-85)\ncreate clone of (_myself_ v)\npoint in direction (180)\ngo to x: (50) y: (-85)\ncreate clone of (_myself_ v)\n\nchange y by (50)\n\ndefine Clone L13\npoint in direction (90)\ngo to x: (-149) y: (-97)\nrepeat (3)\n    create clone of (_myself_ v)\n    change x by (150)\nend\n\ngo to x: (-168) y: (-91)\npoint in direction (90)\ncreate clone of (_myself_ v)\n\nif <(Level) = [7]> then\n    show\n    Clone L13\nend\nif <(Level) = [8]> then\n    hide\nend\nif <(Level) = [9]> then\n    show\n    Clone L9\nend\n\n@Saw\n\nwhen I receive [next level v]\ngo to [back v] layer\nwait (0) seconds\nif <(Level) = [5]> then\n    go to x: (-89) y: (-116)\n    set size to (100) %\n    create clone of (_myself_ v)\n    go to x: (30) y: (50)\n    set size to (200) %\n    create clone of (_myself_ v)\n    go to x: (166) y: (-112)\n    set size to (100) %\n    create clone of (_myself_ v)\nend\nif <(Level) = [8]> then\n    go to x: (-40) y: (-95)\n    set size to (150) %\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\nforever\n    turn left (15) degrees\nend\n\nrepeat until <(Level) = [9]>\n\ndelete this clone\n\ngo to x: (26) y: (-33)\n\nwhen I receive [next level v]\ndelete this clone\n\ngo to x: (-120) y: (-106)\n\ngo to x: (-23) y: (123)\n\nif <(Level) = [14]> then\n    set size to (80) %\n    go to x: (-23) y: (123)\n    create clone of (_myself_ v)\nend\nif <(Level) = [16]> then\n    set size to (120) %\n    go to x: (-71) y: (-118)\n    create clone of (_myself_ v)\n    go to x: (131) y: (-57)\n    create clone of (_myself_ v)\nend\nhide\n\n@Cloud\n\nwhen flag clicked\nhide\nset rotation style [left-right v]\nswitch costume to (big v)\nset x to (280)\nforever\n    switch costume to (big v)\n    create clone of (_myself_ v)\n    wait (pick random (1.) to (2.)) seconds\nend\n\nwhen I start as a clone\nshow\nswitch costume to (pick random (1) to (5))\nset [costume v] to (costume [number v])\nset [ghost v] effect to (pick random (30) to (70))\nset y to (pick random (80) to (180))\nset [sx v] to (pick random (3.) to (5.))\nrepeat ((600) / (sx))\n    go to [back v] layer\n    switch costume to (big v)\n    change x by ((-1) * (sx))\n    switch costume to (costume)\nend\ndelete this clone\n\n@Word\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\npoint in direction (90)\nswitch costume to (join [Level] (Level))\n\nwhen I receive [next level v]\nswitch costume to (join [Level] (Level))\n\n@Thumbnail\n\nwhen flag clicked\nhide\n\n