Lego - A Platformer

Instructions: Hi welcome to Lego!\n\nInstructions:\n- Use the arrow keys, wasd, or mobile to move.\n- Dont touch red lava!\n- Yellow is bounce.\n- Green is ground.

@Stage\n\nwhen I receive [start v]\nforever\n    play sound [1 v] until done\nend\n\n@Player\n\ndefine Do Physics\nchange [yv v] by (-1)\nif <<key (left arrow v) pressed?> or <<<(mouse x) < (x position)> and <mouse down?>> or <key (a v) pressed?>>> then\n    change [xv v] by (-0.9)\nend\nif <<key (right arrow v) pressed?> or <<<(mouse x) > (x position)> and <mouse down?>> or <key (d v) pressed?>>> then\n    change [xv v] by (0.9)\nend\nset [xv v] to ((xv) * (0.9))\nchange x by (xv)\nif <<touching color (#8bdd65)?> or <touching color (#73cd4b)?>> then\n    change y by (1)\nend\nif <<touching color (#8bdd65)?> or <touching color (#73cd4b)?>> then\n    change y by (1)\nend\nif <<touching color (#8bdd65)?> or <touching color (#73cd4b)?>> then\n    change y by (1)\nend\nif <<touching color (#8bdd65)?> or <touching color (#73cd4b)?>> then\n    change y by (1)\nend\nif <<touching color (#8bdd65)?> or <touching color (#73cd4b)?>> then\n    change y by (1)\nend\nif <<touching color (#8bdd65)?> or <touching color (#73cd4b)?>> then\n    change y by (1)\nend\nif <<touching color (#8bdd65)?> or <touching color (#73cd4b)?>> then\n    change y by (-4)\n    change x by ((xv) * (-1))\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<(mouse y) > (y position)> and <mouse down?>>>> then\n        set [yv v] to [12.5]\n        if <(xv) > [0]> then\n            set [xv v] to [-7]\n        else\n            set [xv v] to [7]\n        end\n    else\n        set [xv v] to [0]\n    end\nend\nchange y by (yv)\nif <<touching color (#8bdd65)?> or <touching color (#73cd4b)?>> then\n    change y by ((yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<<key (up arrow v) pressed?> or <<<(mouse y) > (y position)> and <mouse down?>> or <key (w v) pressed?>>> and <<touching color (#8bdd65)?> or <touching color (#73cd4b)?>>> then\n    set [yv v] to [12]\nend\n\ndefine Special\nif <<touching color (#ffcc00)?> or <touching color (#ffe272)?>> then\n    set [yv v] to [20]\nend\nif <<(y position) < [-180]> or <touching color (#fa883e)?>> then\n    start sound [Death! v]\n    set [xv v] to [0]\n    set [yv v] to [0]\n    go to x: (-210) y: (-20)\nend\n\nwhen I receive [pos v]\ngo to x: (-210) y: (-20)\n\nwhen I receive [start v]\nwait (0.001) seconds\nset [level v] to [1]\nset [xv v] to [0]\nset [yv v] to [0]\nshow\ngo to x: (-210) y: (-20)\nforever\n    Do Physics\n    Special\nend\n\nwhen I receive [start v]\nforever\n    if <(x position) > [220]> then\n        go to x: (-210) y: (-20)\n        broadcast (next v)\n        change [level v] by (1)\n    end\nend\n\n@Level\n\nwhen I receive [next v]\nnext costume\n\nwhen I receive [start v]\nswitch costume to (1 v)\ngo to x: (0) y: (0)\n\n@Thumbnail\n\nwhen I receive [start v]\ngo to [front v] layer\ngo to x: (0) y: (0)\nwait (2) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\n    change [pixelate v] effect by (10)\nend\nhide\n\nwhen flag clicked\nshow\n\n@Skip\n\nwhen flag clicked\nforever\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        if <not <([costume # v] of [level v]) = [10]>> then\n            wait until <not <mouse down?>>\n            start sound [1 v]\n            broadcast (Pos v)\n            broadcast (next v)\n        end\n    end\nend\n\nwhen I receive [start v]\nset [data v] to [80]\nset [direction v] to [0]\nset size to (100) %\ngo to x: (-180) y: (-155)\npoint in direction (90)\nforever\n    set size to (Data) %\n    if <touching (mouse-pointer v)?> then\n        change [data v] by (3)\n        change [direction v] by (5)\n        point in direction ((([sin v] of (Direction) ) * (3)) + (90))\n    end\n    set [data v] to ((Data) * (0.85))\n    change [data v] by (13)\nend\n\nwhen I receive [start v]\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (2 v)\n    else\n        switch costume to (1 v)\n        repeat until <(direction) = [90]>\n            change [direction v] by (5)\n            point in direction ((([sin v] of (Direction) ) * (5)) + (90))\n        end\n    end\nend\n\n@Intro\n\nwhen flag clicked\nhide\ngo to [front v] layer\ngo to x: (0) y: (0)\npoint in direction (90)\nset [stop v] to [Start]\nset [y v] to [210]\nset [brightness v] to [0]\nwait (0.1) seconds\nswitch costume to (1 v)\nrepeat (6)\n    create clone of (_myself_ v)\n    change [y v] by (-60)\n    change [brightness v] by (5)\n    wait (0.1) seconds\nend\nwait (1.7) seconds\nswitch costume to (2 v)\ncreate clone of (_myself_ v)\nwait (1.7) seconds\nswitch costume to (3 v)\ncreate clone of (_myself_ v)\nset [stop v] to [Stop]\n\nwhen I start as a clone\nif <(costume [number v]) = [1]> then\n    go to x: (-10000) y: (Y)\n    switch costume to (1 v)\n    set [brightness v] effect to (Brightness)\n    repeat (100)\n        change x by ((x position) / (-10))\n    end\nend\n\nwhen I start as a clone\nshow\n\nwhen I start as a clone\nif <(costume [number v]) = [2]> then\n    set size to (500) %\n    switch costume to (2 v)\n    repeat (25)\n        change size by (((100) - (size)) * (0.3))\n    end\n    repeat (25)\n        change x by (((150) - (x position)) * (0.3))\n    end\nend\n\nwhen I start as a clone\nif <(costume [number v]) = [3]> then\n    go to x: (-1000) y: (0)\n    switch costume to (3 v)\n    repeat (25)\n        change x by (((0) - (x position)) * (0.3))\n    end\nend\n\nwhen I start as a clone\nif <(costume [number v]) = [3]> then\n    go to x: (-1000) y: (0)\n    set size to (500) %\n    switch costume to (3 v)\n    repeat (25)\n        change size by (((90) - (size)) * (0.3))\n    end\nend\n\nwhen flag clicked\nswitch costume to (background v)\ncreate clone of (_myself_ v)\nplay sound [ v] until done\n\nwhen I start as a clone\nforever\n    if <(Stop) = [Stop]> then\n        wait (1.5) seconds\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        broadcast (Start v) and wait\n        set [stop v] to [End]\n    end\nend\n\nwhen I start as a clone\nif <(costume [number v]) = [4]> then\n    switch costume to (background v)\n    go to [front v] layer\nend\n\nwhen I start as a clone\ngo to [front v] layer\n\n