Christmas Chaos - a Platformer 

Instructions:               MERRY CHRISTMAS EVERYBODY! \n                      AND A HAPPY NEW YEAR!\n\n - Also, this project was shared on Christmas eve!\n- I'm proud of this\n  \n         ~Controls~\n- WASD or Arrow keys to move\n- Sorry; it's not mobile\n- Every level is 100% possible\n       

@Stage\n\nwhen flag clicked\nforever\n    play sound [Music v] until done\nend\n\n@Player\n\ndefine Check touching Solid\nif <<touching (level v)?> or <touching (platform v)?>> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\ndefine Collide Y - Ceiling or floor\nset y to (last value)\nif <(speed y) > [0]> then\n    set [speed y v] to [0]\n    stop [this script v]\nend\nif <(falling) > [0]> then\n    set [falling v] to [0]\n    Slip\nend\nset [speed y v] to ((speed y) * (0.8))\n\ndefine Reset and Begin Level\nset [long jump v] to [0]\nset [jumping v] to [0]\nset [wall slide v] to [0]\nset [speed y v] to [0]\nset [speed x v] to [0]\nset [falling v] to [99]\npoint in direction (90)\nBegin Scene # (SCENE #) Go to x,y: [-182] [175]\n\ndefine Move - in steps (steps)\nchange [falling v] by (1)\nrepeat (steps)\n    set [last value v] to (x position)\n    change x by ((speed x) / (steps))\n    Check touching Solid\n    if <(touching) > [0]> then\n        Collide X - Slope or Wall?\n    end\n    set [last value v] to (y position)\n    change y by ((speed y) / (steps))\n    Check touching Solid\n    if <(touching) > [0]> then\n        Collide Y - Ceiling or floor\n    end\nend\n\nwhen I receive [tick - first v]\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nset [platform dx v] to []\nset [platform dy v] to []\n\ndefine Fix Collision in Direction (dir)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (128)\n    Check touching Solid\n    if <(touching) < [1]> then\n        point in direction (temp)\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 Set costume\nset rotation style [left-right v]\nif <(wall slide) > [0]> then\n    switch costume to (hangon01 v)\n    stop [this script v]\nend\nif <(falling) > [1]> then\n    if <(speed y) > [0]> then\n        switch costume to (jump01 v)\n    else\n        switch costume to (run_j2 v)\n    end\n    stop [this script v]\nend\nif <(frame) > [0]> then\n    switch costume to ((1) + ((frame) mod (15)))\nelse\n    switch costume to (hit angle 0 v)\n    repeat (5)\n        Check touching Solid\n        if <(touching) < [1]> then\n            switch costume to ((costume [number v]) + (5))\n            stop [this script v]\n        end\n        next costume\n    end\n    switch costume to (stand v)\nend\n\ndefine Controls - up and down\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    if <<(wall slide) > [0]> and <(jumping) = [0]>> then\n        start sound [Jump v]\n        set [jumping v] to [1]\n        set [falling v] to [3]\n        set [wall slide v] to [0]\n        turn right (180) degrees\n        set [speed x v] to (((direction) / (90)) * (7))\n        set [long jump v] to [12]\n    end\n    if <<(falling) < [3]> and <(jumping) = [0]>> then\n        start sound [Jump v]\n        set [jumping v] to [1]\n        set [falling v] to [3]\n    end\n    if <<(jumping) > [0]> and <(jumping) < (JUMP DURATION)>> then\n        change [jumping v] by (1)\n        set [speed y v] to (JUMP FORCE)\n    end\nelse\n    set [jumping v] to [0]\nend\nchange [speed y v] by (GRAVITY)\nif <(wall slide) > [0]> then\n    Check can wall slide\n    if <(speed y) < [0]> then\n        set [speed y v] to ((speed y) * (0.8))\n    end\nend\n\nwhen I receive [tick - last v]\nif <(x position) > [235]> then\n    Begin Scene # ((SCENE #) + (1)) Go to x,y: [-235] (y position)\nend\nif <(x position) < [-235]> then\n    Begin Scene # ((SCENE #) + (-1)) Go to x,y: [235] (y position)\nend\nif <touching (danger v)?> then\n    broadcast (Lose Life v)\nend\n\ndefine Slip\nchange x by (1)\nchange y by (-2)\nCheck touching Solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (1)\n    stop [this script v]\nend\nchange x by (-2)\nCheck touching Solid\nif <(touching) < [1]> then\n    set [falling v] to [9]\n    change [speed x v] by (-1)\n    stop [this script v]\nend\nchange y by (1)\nchange x by (1)\n\ndefine Conrols - Left and Right\nif <(long jump) > [0]> then\n    change [long jump v] by (-1)\n    stop [this script v]\nend\nset [key x v] to (<<key (right arrow v) pressed?> or <key (d v) pressed?>> - <<key (left arrow v) pressed?> or <key (a v) pressed?>>)\nif <(KEY X) = [0]> then\n    if <<(falling) > [2]> and <(wall slide) < [1]>> then\n        set [speed x v] to ((speed x) * (0.8))\n        stop [this script v]\n    end\n    if <([abs v] of (speed x) ) < [1]> then\n        set [frame v] to [0]\n        set [speed x v] to [0]\n    else\n        change [frame v] by (0.5)\n    end\nelse\n    change [speed x v] by ((KEY X) * (ACCELERATION))\n    point in direction ((KEY X) * (90))\n    change [frame v] by (1)\nend\nset [speed x v] to ((speed x) * (RESISTANCE))\n\ndefine Check can wall slide\nif <(falling) < [2]> then\n    set [wall slide v] to [0]\n    stop [this script v]\nend\nswitch costume to (hitbox wallslide v)\nset rotation style [left-right v]\nCheck touching Solid\nset [wall slide v] to (touching)\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\n\ndefine Collide X - Slope or Wall?\nCheck can wall slide\nchange y by (1)\nCheck touching Solid\nif <(touching) > [0]> then\n    change y by (1)\n    Check touching Solid\n    if <(touching) > [0]> then\n        change y by (-2)\n        set x to (last value)\n        set [speed x v] to [0]\n        stop [this script v]\n    end\n    set [speed x v] to ((speed x) * (0.9))\nend\nset [speed x v] to ((speed x) * (0.95))\n\nwhen I receive [tick - player v]\nMoved by - Moving Platform\nswitch backdrop to <touching (level v)?>\nControls - up and down\nConrols - Left and Right\nMove - in steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\nSet costume\n\ndefine Begin Scene # (scene) Go to x,y: (x) (y)\nset y to (y)\nset [scene # v] to (scene)\nset x to (x)\nbroadcast (Change Scene v)\nstop [other scripts in sprite v]\nwait (0) seconds\nswitch costume to (hitbox v2 v)\nset rotation style [don't rotate v]\nFix Collision in Direction [0]\nSet costume\nbroadcast (Game Loop v)\n\nwhen I receive [game loop v]\nset [ghost v] effect to (0)\nforever\n    broadcast (Tick - first v)\n    broadcast (Tick - platforms v)\n    broadcast (Tick - Player v)\n    broadcast (Tick - Last v)\nend\n\nwhen flag clicked\nset [scene # v] to [1]\nset [resistance v] to [0.8]\nset [gravity v] to [-1.5]\nset [acceleration v] to [2]\nset [jump force v] to [14]\nset [jump duration v] to [6]\nbroadcast (Setup v) and wait\nReset and Begin Level\n\nwhen I receive [lose life v]\nstop [other scripts in sprite v]\nbroadcast (death v)\nswitch costume to (die v)\nstart sound [Crunch v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nwait (0.1) seconds\nReset and Begin Level\n\ndefine Moved by - Moving Platform\nchange x by (PLATFORM DX)\nchange y by (PLATFORM DY)\nCheck touching Solid\nif <(touching) > [0]> then\n    Find Closest Space to (x position) (y position) max [16]\n    if <(touching) > [0]> then\n        broadcast (Lose Life v)\n    end\nend\n\ndefine Find Closest Space to (x) (y) max (max)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (0)\nrepeat (max)\n    repeat (16)\n        go to x: (x) y: (y)\n        move (distance) steps\n        Check touching Solid\n        if <(touching) < [1]> then\n            point in direction (temp)\n            stop [this script v]\n        end\n        turn right (22.5) degrees\n    end\n    change [distance v] by (1)\nend\ngo to x: (x) y: (y)\npoint in direction (temp)\n\nFind Closest Space to (x position) (y position) max [100]\n\n@Level\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (SCENE #))\n\n@Danger\n\nwhen flag clicked\ngo to [back v] layer\ngo to x: (0) y: (0)\n\nwhen I receive [change scene v]\ngo to [back v] layer\nswitch costume to (blank v)\nswitch costume to (join [Scene] (SCENE #))\nif <(SCENE #) = [4]> then\n    forever\n        set y to ((4) * ([sin v] of ((timer) * (270)) ))\n    end\nend\nif <(SCENE #) = [7]> then\n    forever\n        set y to ((4) * ([sin v] of ((timer) * (270)) ))\n    end\nend\nif <(SCENE #) = [13]> then\n    forever\n        set y to ((4) * ([sin v] of ((timer) * (270)) ))\n    end\nend\n\n@Platform\n\nwhen I receive [change scene v]\nhide\nif <(SCENE #) = [7]> then\n    switch costume to (platform1 v)\n    show\n    Animate Platform\nend\nif <(SCENE #) = [8]> then\n    switch costume to (platform2 v)\n    show\n    Animate 2\nend\nif <(SCENE #) = [11]> then\n    switch costume to (platform3 v)\n    show\n    Animate 3\nend\nif <(SCENE #) = [15]> then\n    switch costume to (platform4 v)\n    show\n    Animate 2\nend\nif <(SCENE #) = [16]> then\n    switch costume to (platform5 v)\n    show\n    Animate 4\nend\nif <(SCENE #) = [20]> then\n    switch costume to (platform6 v)\n    show\n    Animate 5\nend\n\ndefine Animate Platform\ngo to x: (-94) y: (-164)\nforever\n    glide (2) secs to x: (118) y: (60)\n    wait (0.5) seconds\n    glide (2) secs to x: (-94) y: (-164)\n    wait (0.5) seconds\nend\n\nwhen I receive [tick - platforms v]\nTick (x position) (y position)\nset [last x v] to (x position)\nset [last y v] to (y position)\n\ndefine Tick (new x) (new y)\nif <(new y) > (last y)> then\n    change y by (1)\nelse\n    set y to ((last y) + (1))\nend\nif <touching (player v)?> then\n    set [platform dx v] to ((new x) - (last x))\n    set [platform dy v] to ((new y) - (last y))\nend\ngo to x: (new x) y: (new y)\n\ndefine Animate 2\ngo to x: (-16) y: (65)\nforever\n    glide (0.2) secs to x: (-16) y: (-100)\n    wait (0.5) seconds\n    glide (0.7) secs to x: (-16) y: (0)\n    wait (0.3) seconds\nend\n\nwhen flag clicked\ngo to [back v] layer\n\ndefine Animate 3\ngo to x: (-108) y: (-45)\nforever\n    glide (2.5) secs to x: (209) y: (0)\n    wait (0.5) seconds\n    glide (2) secs to x: (-113) y: (57)\n    glide (0.5) secs to x: (-188) y: (91)\n    wait (0.5) seconds\n    glide (2) secs to x: (-108) y: (-45)\n    wait (0.5) seconds\nend\n\ndefine Animate 4\ngo to x: (-16) y: (0)\nforever\n    set y to ((4) * ([sin v] of ((timer) * (270)) ))\nend\n\ndefine Animate 5\ngo to x: (0) y: (0)\nforever\n    glide (0.3) secs to x: (0) y: (-84)\n    wait (0.5) seconds\n    glide (0.5) secs to x: (0) y: (0)\n    wait (0.7) seconds\nend\n\n@Collectable\n\nwhen I receive [change scene v]\nif <(SCENE #) = (my scene)> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nrepeat until <touching (player v)?>\n    change y by ((0.5) * ([sin v] of (frame) ))\n    change [frame v] by (5)\nend\nset [my scene v] to []\nstart sound [ding v]\nrepeat (20)\n    change y by (2)\n    change [ghost v] effect by (5)\nend\nhide\n\nwhen I receive [setup v]\nset [frame v] to [0]\nhide\nPlace [Gift] Scene [1] XY [200] [-50]\nPlace [Gift2] Scene [2] XY [-12] [3]\nPlace [Gift3] Scene [3] XY [143] [57]\nPlace [Gift] Scene [4] XY [-99] [68]\nPlace [Gift2] Scene [4] XY [99] [68]\nPlace [Gift3] Scene [5] XY [-93] [-56]\nPlace [Gift] Scene [5] XY [12] [-56]\nPlace [Gift2] Scene [5] XY [130] [-56]\nPlace [Gift3] Scene [6] XY [-161] [184]\nPlace [Gift] Scene [6] XY [170] [120]\nPlace [Gift2] Scene [7] XY [-18] [98]\nPlace [Gift3] Scene [7] XY [210] [167]\nPlace [Gift] Scene [8] XY [74] [14]\nPlace [Gift2] Scene [9] XY [-83] [-6]\nPlace [Gift3] Scene [9] XY [123] [76]\nPlace [Gift] Scene [10] XY [-151] [30]\nPlace [Gift2] Scene [10] XY [163] [0]\nPlace [Gift3] Scene [11] XY [202] [127]\nPlace [Gift] Scene [11] XY [-12] [149]\nPlace [Gift2] Scene [11] XY [-109] [100]\nPlace [Gift3] Scene [12] XY [-215] [-60]\nPlace [Gift] Scene [12] XY [-164] [-60]\nPlace [Gift2] Scene [12] XY [-124] [-17]\nPlace [Gift3] Scene [12] XY [-60] [-17]\nPlace [Gift] Scene [12] XY [-10] [27]\nPlace [Gift2] Scene [12] XY [45] [27]\nPlace [Gift3] Scene [12] XY [97] [68]\nPlace [Gift] Scene [12] XY [160] [69]\nPlace [Gift2] Scene [12] XY [210] [125]\nPlace [Gift3] Scene [13] XY [-108] [18]\nPlace [Gift] Scene [13] XY [111] [-42]\nPlace [Gift2] Scene [14] XY [-55] [-50]\nPlace [Gift3] Scene [14] XY [55] [90]\nPlace [Gift] Scene [15] XY [-70] [30]\nPlace [Gift2] Scene [15] XY [35] [30]\nPlace [Gift3] Scene [15] XY [150] [30]\nPlace [Gift] Scene [16] XY [-103] [-26]\nPlace [Gift2] Scene [17] XY [-197] [35]\nPlace [Gift3] Scene [17] XY [7] [-19]\nPlace [Gift] Scene [18] XY [-40] [-10]\nPlace [Gift2] Scene [18] XY [115] [45]\nPlace [Gift3] Scene [18] XY [115] [135]\nPlace [Gift] Scene [19] XY [-155] [-20]\nPlace [Gift2] Scene [19] XY [-6] [48]\nPlace [Gift3] Scene [19] XY [147] [-4]\nPlace [Gift] Scene [20] XY [-183] [-9]\nPlace [Gift2] Scene [20] XY [-5] [18]\nPlace [Gift3] Scene [20] XY [205] [-55]\n\ndefine Place (costume name) Scene (scene) XY (x) (y)\nset [my scene v] to (scene)\nswitch costume to (costume name)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nset [my scene v] to []\n\n@Text\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (SCENE #))\n\nwhen I receive [change scene v]\nif <(SCENE #) = [17]> then\n    forever\n        go to [front v] layer\n    end\nelse\n    forever\n        go to [back v] layer\n    end\nend\n\n@Snow\n\nwhen flag clicked\nhide\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\ngo to [back v] layer\nshow\ngo to x: (pick random (-250) to (250)) y: (200)\nset size to (pick random (50) to (140)) %\nset [ghost v] effect to (pick random (5) to (30))\nglide (pick random (1) to (3)) secs to x: (x position) y: (-200)\ndelete this clone\n\n@Thumbnail\n\nwhen flag clicked\nswitch costume to (costume4 v)\nset [ghost v] effect to (100)\n\nwhen [timer v] > (0)\ngo to [front v] layer\n\n