Platformer - A platformer

Instructions: "You know the rules,\nAnd so do I."

@Stage\n\nwhen flag clicked\nswitch costume to (title1 v)\n\nwhen I receive [nextlevel v]\nnext costume\n\n@Player\n\nwhen flag clicked\nset size to (20) %\nswitch costume to (player v)\ngo to x: (-220) y: (-50)\nset [xsped v] to [0]\nset [ysped v] to [0]\ngo to [front v] layer\nforever\n    set [xsped v] to ((XSped) * (0.6))\n    change y by (YSped)\n    change x by (XSped)\n    if <<(HitOrbAready?) = [Yh]> or <(GimmickTrailActivation?) = [Yh]>> then\n        ContinueTrail?\n    end\n    if <<touching (gimmicky green v)?> and <not <touching (thelevel v)?>>> then\n        change [ysped v] by (0.5)\n    end\n    NavigateLvl\n    if <<touching color (#ff4d4d)?> or <touching color (#ff3434)?>> then\n        repeat (5)\n            SpawnParticlesForDeath\n            set [xsped v] to ((XSped) * (0.6))\n            change y by (YSped)\n            change x by (XSped)\n            change [ghost v] effect by (20)\n            if <<touching (gimmicky green v)?> and <not <touching (thelevel v)?>>> then\n                change [ysped v] by (0.5)\n                set [gimmicktrailactivation? v] to [Yh]\n            end\n            NavigateLvl\n        end\n        wait (0.3) seconds\n        set [xsped v] to [0]\n        set [ysped v] to [0]\n        clear graphic effects\n        go to x: (-240) y: (-50)\n        set [xsped v] to [20]\n    end\n    if <touching (gimmickyyellow v)?> then\n        if <key (up arrow v) pressed?> then\n            set [ysped v] to [10]\n            set [hitorbaready? v] to [Yh]\n            broadcast (FlashTheOrb v)\n        end\n    end\n    if <(x position) > [239]> then\n        broadcast (NextLevel v)\n        go to x: (-220) y: (-50)\n        set [xsped v] to [0]\n        set [ysped v] to [0]\n    end\nend\n\ndefine NavigateLvl\nif <key (right arrow v) pressed?> then\n    change [xsped v] by (3)\nend\nif <key (left arrow v) pressed?> then\n    change [xsped v] by (-3)\nend\nif <touching (gimmicky blue v)?> then\n    set [gimmicktrailactivation? v] to [Yh]\n    broadcast (FlashTheBlue v)\n    change y by ((YSped) * (-1))\n    if <touching (gimmicky blue v)?> then\n        change y by (YSped)\n        set [xsped v] to ((XSped) * (-1.8))\n        change x by (XSped)\n    else\n        set [ysped v] to [7]\n        change y by (YSped)\n    end\nend\nif <not <touching (thelevel v)?>> then\n    change [ysped v] by (-1)\nelse\n    change y by ((YSped) * (-1))\n    set [otherysped v] to (YSped)\n    set [ysped v] to (round (YSped))\n    repeat until <<touching (thelevel v)?> or <(YSped) = [0]>>\n        if <(YSped) < [1]> then\n            change y by (-1)\n            change [ysped v] by (1)\n        else\n            change y by (1)\n            change [ysped v] by (-1)\n        end\n    end\n    set [ysped v] to (OtherYSped)\n    change y by (1)\n    if <touching (thelevel v)?> then\n        set [otherxsped v] to (XSped)\n        set [xsped v] to ((XSped) * (-1))\n        if <(XSped) < [0]> then\n            repeat (30)\n                if <touching (thelevel v)?> then\n                    change x by (-0.25)\n                end\n            end\n            set [xsped v] to [0]\n        else\n            repeat (30)\n                if <touching (thelevel v)?> then\n                    change x by (0.25)\n                end\n            end\n            set [xsped v] to [0]\n        end\n        if <not <touching (thelevel v)?>> then\n            change [ysped v] by (-1)\n            change y by (YSped)\n        else\n            set [ysped v] to [0]\n        end\n    else\n        set [ysped v] to [0]\n        if <<key (up arrow v) pressed?> or <key (space v) pressed?>> then\n            set [ysped v] to [10]\n        end\n    end\n    if <<touching (thelevel v)?> or <key (space v) pressed?>> then\n        change y by (1)\n        change [ysped v] by (1)\n        if <key (up arrow v) pressed?> then\n            set [ysped v] to [10]\n        end\n    end\nend\nif <touching (thelevel v)?> then\n    set [xsped v] to (OtherXSped)\n    set [ysped v] to [-1]\n    change x by (OtherXSped)\n    change y by (-2)\n    if <(round (XSped)) = [0]> then\n        if <(XSped) < [0]> then\n            change x by (-7.5)\n        else\n            change x by (7.5)\n        end\n    end\nend\nswitch costume to (particles v)\nif <touching (thelevel v)?> then\n    switch costume to (player v)\n    change x by ((XSped) * (-2))\n    if <touching (thelevel v)?> then\n        repeat until <not <touching (thelevel v)?>>\n            change y by (1)\n        end\n    end\n    change x by ((XSped) / (2))\nend\nswitch costume to (player v)\n\ndefine SpawnParticlesForDeath\nset [cloneorders? v] to [Death]\nrepeat (10)\n    create clone of (trail v)\nend\n\nwhen flag clicked\nwait (1) seconds\ngo to [front v] layer\n\ngo to x: (-220) y: (-50)\n\ndefine ContinueTrail?\nif <touching (thelevel v)?> then\n    set [hitorbaready? v] to [Nope]\n    set [gimmicktrailactivation? v] to [Nope]\nelse\n    set [cloneorders? v] to [OrbsEtc]\n    create clone of (trail v)\nend\n\nwhen [b v] key pressed\ngo to x: (-220) y: (-50)\n\n@Trail\n\nwhen I start as a clone\ngo to (player v)\nset rotation style [don't rotate v]\nclear graphic effects\nshow\nif <(CloneOrders?) = [Death]> then\n    go to [front v] layer\n    switch costume to (particles v)\n    point in direction (pick random (180) to (-180))\n    set size to (pick random (10) to (40)) %\n    set [aclonething v] to (pick random (10) to (20))\n    set [clonemovementthing v] to (pick random (0.7) to (5.0))\n    repeat (ACloneThing)\n        move (CloneMovementThing) steps\n        change [ghost v] effect by ((100) / (ACloneThing))\n    end\n    delete this clone\nend\nif <(CloneOrders?) = [OrbsEtc]> then\n    switch costume to (particles v)\n    set size to (100) %\n    repeat (20)\n        change size by (-5)\n        change [ghost v] effect by (5)\n    end\nend\ndelete this clone\n\nwhen flag clicked\nhide\n\n@TheLevel\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (0) y: (0)\nswitch costume to (level1 v)\n\nwhen I receive [nextlevel v]\nnext costume\n\n@Shadows&Hazards\n\nwhen flag clicked\nerase all\ngo to x: (0) y: (0)\nswitch costume to (shadow1 v)\ngo to [back v] layer\nclear graphic effects\nshow\n\nwhen I receive [nextlevel v]\nnext costume\nif <(costume [number v]) = [22]> then\n    set [brightness v] effect to (-100)\n    go to [front v] layer\n    repeat (3)\n        create clone of (_myself_ v)\n        wait (1) seconds\n    end\n    wait (1.5) seconds\n    repeat (100)\n        change [brightness v] effect by (1)\n    end\nend\n\nwhen I start as a clone\ngo to x: (240) y: (0)\nshow\nclear graphic effects\ngo to [front v] layer\nswitch costume to (ripples v)\nset [ghost v] effect to (100)\nset size to (2) %\nrepeat (50)\n    change size by (2.22)\n    change [ghost v] effect by (-2)\nend\nrepeat (50)\n    change size by (2.22)\n    change [ghost v] effect by (2)\nend\n\nset [brightness v] effect to (-100)\ngo to [front v] layer\nrepeat (3)\n    create clone of (_myself_ v)\n    wait (1) seconds\nend\nwait (1.5) seconds\nrepeat (100)\n    change [brightness v] effect by (1)\nend\n\nif <(costume [number v]) = [20]> then\n    broadcast (NextLevel v)\nend\n\n@GimmickyYellow\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (gimmick1 v)\n\nwhen I receive [nextlevel v]\nnext costume\n\nwhen I receive [flashtheorb v]\nset [brightness v] effect to (50)\nrepeat (5)\n    change [brightness v] effect by (-10)\nend\n\n@Gimmicky Blue\n\nwhen flag clicked\nswitch costume to (gimmick1 v)\ngo to x: (0) y: (0)\n\nwhen I receive [nextlevel v]\nnext costume\n\nwhen I receive [flashtheblue v]\nset [brightness v] effect to (50)\nrepeat (5)\n    change [brightness v] effect by (-10)\nend\n\n@Gimmicky Green\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (gimmick1 v)\nforever\n    if <touching (player v)?> then\n        set [brightness v] effect to (20)\n    else\n        clear graphic effects\n    end\nend\n\nwhen I receive [nextlevel v]\nnext costume\n\nwhen flag clicked\nforever\n    if <<(GimmickTrailActivation?) = [Nope]> and <touching (player v)?>> then\n        set [gimmicktrailactivation? v] to [Yh]\n    end\nend\n\n@T H I N G\n\nrepeat (19)\nend\n\nbroadcast (NextLevel v)\n\n