The Darkness - A Platformer

Instructions: - Arrow Keys To Move (Or WASD)\n- Trampolines Boost You In The Air\n- The Gray Station Makes You Smaller\n- Get To The Flag To Win\n-Can We Get Top Loved?!??!?!\n- Wow It Was Hard To Make!\n- R to Reset\n-S to Skip(even though it is quite easy)

@Stage\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    switch backdrop to (Level)\nend\n\nwhen flag clicked\n\nwhen flag clicked\n\nwhen flag clicked\n\nwhen flag clicked\n\nwhen flag clicked\nforever\n    play sound [Mooosic v] until done\nend\n\n@Player\n\nwhen flag clicked\nset [yv v] to [0]\nset size to (100) %\nset [xv v] to [0]\ngo to x: (-223) y: (29)\nforever\n    if <(size) = [100]> then\n        Platform [15] [-1] [0.8] [3]\n    else\n        Platform [10] [-1] [0.8] [3]\n    end\n    if <<touching (spikes v)?> or <(y position) < [-180]>> then\n        respawn\n    end\n    if <touching (trampoline v)?> then\n        set [yv v] to [20]\n    end\n    create clone of (_myself_ v)\nend\n\ndefine Platform (jump height) (gravity) (friction) (running speed)\nswitch costume to (hitbox v)\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    point in direction (90)\n    change [xv v] by (running speed)\nend\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>> then\n    point in direction (-90)\n    change [xv v] by ((running speed) * (-1))\nend\nset [xv v] to ((Xv) * (friction))\nchange x by (Xv)\nif <touching (level v)?> then\n    set [slope v] to [0]\n    repeat until <<(Slope) = [8]> or <not <touching (level v)?>>>\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by ((Slope) * (-1))\n        repeat ([ceiling v] of ([abs v] of (Xv) ) )\n            if <touching (level v)?> then\n                change x by ((([abs v] of (Xv) ) / (Xv)) * (-1))\n            end\n        end\n        set [xv v] to [0]\n    end\nend\nchange y by (Yv)\nif <touching (level v)?> then\n    repeat ([ceiling v] of ([abs v] of (Yv) ) )\n        if <touching (level v)?> then\n            change y by ((([abs v] of (Yv) ) / (Yv)) * (-1))\n        end\n    end\n    if <<(([abs v] of (Yv) ) / (Yv)) = [-1]> and <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>>> then\n        set [yv v] to (jump height)\n    else\n        set [yv v] to [0]\n    end\nelse\n    change [yv v] by (-1)\nend\nswitch costume to (idle v)\nif <<<mouse down?> and <(mouse x) > (x position)>> or <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> or <<mouse down?> and <(x position) > (mouse x)>>>> then\n    switch costume to (Walk)\nend\nif <(Yv) > [2]> then\n    switch costume to (jump v)\nend\nif <[-4] > (Yv)> then\n    switch costume to (fall v)\nend\n\nwhen flag clicked\nset [walk v] to [5]\nset [reset countdown? v] to [false]\nbroadcast (Countdown? v)\ngo to x: (-223) y: (29)\nclear graphic effects\nset size to (100) %\nswitch costume to (idle v)\nset [yv v] to [0]\nset [xv v] to [0]\nforever\n    change [walk v] by (1)\n    if <(Walk) > [8]> then\n        set [walk v] to [5]\n    end\n    wait (0.1) seconds\nend\n\ndefine respawn\nswitch costume to (idle v)\nset [reset countdown? v] to [true]\nbroadcast (Countdown? v)\nclear graphic effects\nset size to (100) %\nswitch costume to (idle v)\nset [yv v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\nset [xv v] to [0]\nrepeat (5)\n    change [ghost v] effect by (20)\n    change size by (100)\nend\ngo to x: (-223) y: (29)\nclear graphic effects\nset size to (100) %\n\ndefine Level Complete\nset [reset countdown? v] to [true]\nbroadcast (Countdown? v)\ngo to x: (-223) y: (29)\nclear graphic effects\nset size to (100) %\nswitch costume to (idle v)\nset [yv v] to [0]\nset [xv v] to [0]\n\nwhen flag clicked\nforever\n    if <<<not <(Level) = [12]>> and <key (s v) pressed?>> or <touching (flag v)?>> then\n        Level Complete\n        change [level v] by (1)\n        wait (2) seconds\n    end\n    if <key (r v) pressed?> then\n        set [reset countdown? v] to [true]\n        broadcast (Countdown? v)\n        go to x: (-223) y: (29)\n        clear graphic effects\n        set size to (100) %\n        switch costume to (idle v)\n        set [yv v] to [0]\n        set [xv v] to [0]\n    end\nend\n\nwhen I start as a clone\nrepeat (3)\n    change [ghost v] effect by (33)\nend\ndelete this clone\n\nwhen I receive [mini v]\nset size to (50) %\nwait (10) seconds\nset size to (100) %\n\n@Level\n\nwhen flag clicked\nforever\n    go to x: (36) y: (28)\n    switch costume to (Level)\nend\n\n@spikes\n\nwhen flag clicked\nforever\n    go to x: (36) y: (28)\n    switch costume to (Level)\nend\n\n@Flag\n\nwhen flag clicked\nswitch costume to (flag v)\nforever\n    next costume\n    wait (0.1) seconds\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [1]> then\n        go to x: (233) y: (-63)\n    end\n    if <(Level) = [2]> then\n        go to x: (232) y: (2)\n    end\n    if <(Level) = [3]> then\n        go to x: (232) y: (2)\n    end\n    if <(Level) = [4]> then\n        go to x: (232) y: (2)\n    end\nend\n\n@Trampoline\n\nwhen flag clicked\nshow\nforever\n    switch costume to (Level)\n    go to x: (0) y: (0)\nend\n\n@Darkness + TM\n\nwhen flag clicked\nset [ghost v] effect to (100)\nswitch costume to (darkness v)\nforever\n    go to [front v] layer\nend\n\nwhen I receive [countdown? v]\nset [ghost v] effect to (100)\nset [reset countdown? v] to [false]\nrepeat (100)\n    wait (0.1) seconds\n    if <(Reset Countdown?) = [true]> then\n        stop [this script v]\n    end\nend\nrepeat (33)\n    change [ghost v] effect by (-3)\nend\n\nswitch costume to (tm v)\nset size to (100) %\ngo to x: (0) y: (0)\nclear graphic effects\ngo to [front v] layer\ngo [forward v] (1) layers\n\n@Mini \n\nwhen flag clicked\ngo to x: (36) y: (28)\nshow\nforever\n    switch costume to (Level)\n    if <touching (player v)?> then\n        broadcast (Mini v)\n    end\nend\n\nwhen flag clicked\nforever\n    start sound [pop v]\nend\n\n