Dark || A Platformer

Instructions: ★★★Instructions★★★\n\n- Up Arrow - To Jump\n- W - To Jump\n- Left Arrow - To Move Left\n- A - To Move Left\n- Right Arrow- To Move Right\n- D - To Move Right

@Stage\n\nwhen I receive [intro v]\nforever\n    play sound [LittleBigPlanet 2 - Halloween Haunted House v] until done\nend\n\n@player\n\ndefine Platformer Physics (speed) (friction) (jump height)\nchange [y vel v] by (-1)\nif <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > ((x position) + (20))>>>> then\n    change [x vel v] by (speed)\n    switch costume to (costume1 v)\nend\nif <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(x position) > ((mouse x) + (20))>>>> then\n    change [x vel v] by ((speed) * (-1))\n    switch costume to (costume2 v)\nend\nset [x vel v] to ((X vel) * (friction))\nchange x by (X vel)\nset [slope v] to [0]\nif <touching (level v)?> then\n    repeat until <<not <touching (level v)?>> or <(slope) = [-8]>>\n        change [slope v] by (-1)\n        change y by (1)\n    end\nend\nif <touching (level v)?> then\n    change y by (slope)\n    repeat until <not <touching (level v)?>>\n        change x by ((([abs v] of (X vel) ) / (X vel)) * (-1))\n    end\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        if <(X vel) > [0]> then\n            set [x vel v] to [-12]\n        else\n            set [x vel v] to [12]\n        end\n        set [y vel v] to [12]\n    else\n        set [x vel v] to [0]\n    end\nend\nchange y by (Y vel)\nif <touching (level v)?> then\n    repeat until <not <touching (level v)?>>\n        change y by ((([abs v] of (Y vel) ) / (Y vel)) * (-1))\n    end\n    set [y vel v] to [0]\nend\nchange y by (-1)\nif <<<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>>> and <touching (level v)?>> then\n    set [y vel v] to (jump height)\nend\nchange y by (1)\n\nwhen I receive [end v]\ngo to x: (-198) y: (-10)\n\nwhen I receive [intro v]\ngo to [back v] layer\nshow\nset [level v] to [1]\nset [x vel v] to [0]\nset [y vel v] to [0]\nswitch costume to (costume1 v)\nReset Position [-198] [-10]\npoint in direction (90)\nforever\n    Platformer Physics [1] [0.9] [13]\n    if <<touching (bird v)?> or <touching (spikes v)?>> then\n        start sound [Roblox Death Sound - OOF Sound Effect v]\n        Reset Position [-198] [-10]\n    end\nend\n\nwhen flag clicked\nset [level v] to [1]\nhide\n\nwhen I receive [intro v]\nwait (2) seconds\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nswitch costume to (effect v)\nrepeat (10)\n    change [ghost v] effect by (10)\n    change size by (-5)\nend\ndelete this clone\n\nwhen flag clicked\nbroadcast (intro v)\n\ndefine Reset Position (x) (y)\ngo to x: (x) y: (y)\n\n@end\n\nwhen I receive [intro v]\nswitch costume to (costume5 v)\nshow\nforever\n    if <touching (player v)?> then\n        broadcast (end v)\n        wait until <not <touching (player v)?>>\n    end\nend\n\nwhen I receive [end v]\nchange [level v] by (1)\n\nwhen I receive [end v]\nchange [level v] by (1)\n\n@Thumbnail\n\nwhen flag clicked\nset [sec v] to [0]\nforever\n    go to [front v] layer\nend\n\nwhen flag clicked\ngo to x: (3) y: (24)\nhide variable [sec v]\nwait (.5) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nbroadcast (TS v)\n\nwhen I receive [ts v]\nshow variable [sec v]\nforever\n    wait (1) seconds\n    change [sec v] by (1)\nend\n\nwhen I receive [go v]\nstop [other scripts in sprite v]\n\n@Level\n\nwhen flag clicked\nset [level v] to [1]\nswitch costume to (Level)\n\nwhen flag clicked\nshow\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [13]> then\n        broadcast (go v)\n    end\nend\n\n@background\n\nwhen I receive [intro v]\nif <(sx) > [0]> then\n    if <([tofront v] of [game v]) = [3]> then\n        go to [front v] layer\n        go [backward v] (1) layers\n    end\nelse\n    if <([tofront v] of [game v]) = [10]> then\n        go to [front v] layer\n        go [backward v] (1) layers\n    end\nend\n\nwhen I receive [intro v]\nset [x v] to [0]\nswitch costume to (dot v)\ngo to x: (0) y: (0)\nset size to (200) %\nswitch costume to (costume2 v)\nshow\nset [mx v] to [0.7]\nset [sx v] to [0.65]\ncreate clone of (_myself_ v)\nset [ghost v] effect to (10)\n\nwhen I receive [intro v]\nif <(showing) > [-1]> then\n    position ((round (((x) - ((@Scroll X) * (mx))) mod (960))) - (600)) ((26) - ((@Scroll Y) * (mx)))\n    change [x v] by (sx)\nend\n\nwhen I start as a clone\nset [x v] to [0]\nswitch costume to (dot v)\ngo to x: (0) y: (0)\nset size to (200) %\nswitch costume to (costume2 v)\nshow\nset [mx v] to [1.1]\nset [sx v] to [-1.1]\nset [ghost v] effect to (60)\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\n\n@Bird\n\nwhen flag clicked\ngo to x: (-219) y: (147)\nset size to (30) %\nforever\n    go to [back v] layer\n    wait (.1) seconds\n    next costume\nend\n\nwhen I receive [intro v]\nforever\n    glide (5) secs to x: (252) y: (y position)\n    go to x: (-219) y: (147)\nend\n\n