*FIXED* The Platformer Before Christmas 2.0

Instructions: If you are brave, check out the very cursed version of this: https://scratch.mit.edu/projects/349921115/\n\nOh no! Santa has dropped some presents from his sleigh and needs them back quickly! Are you a jolly enough dude to help save Christmas?\n\n\nEvinor: A new version update! You can acctually finish the game now! 13.11.2019\n\nArrows or WASD to move,\nGet to the Present to advance!

@Stage\n\nwhen flag clicked\nset volume to (100) %\nforever\n    play sound [aurora-zone v] until done\nend\n\n@Hitbox\n\nwhen flag clicked\nset size to (100) %\nshow\nset [ghost v] effect to (100)\ngo to x: (-200) y: (-172)\n\ndefine Physics\nchange y by (yVel)\nchange y by (-1)\nif <touching (ground v)?> then\n    if <(yVel) < [.5]> then\n        set [ycollision v] to [1]\n        set [xglide v] to [0]\n        set [yvel v] to [0]\n        if <[0] = (Double Jump)> then\n            set [jump v] to (Jump Height)\n        else\n            set [jump v] to [2]\n        end\n        goUp\n    else\n        set [yvel v] to [0]\n        set [jump v] to [0]\n        goDown\n    end\nelse\n    set [ycollision v] to [0]\n    change [yvel v] by ((0) - (Gravity))\nend\nif <not <<key (w v) pressed?> or <<key (up arrow v) pressed?> or <key (space v) pressed?>>>> then\n    set [spacepressed v] to [0]\nend\nif <<[0] < (jump)> and <<key (w v) pressed?> or <<key (up arrow v) pressed?> or <key (space v) pressed?>>>> then\n    change y by (1)\n    if <[0] = (move)> then\n        if <not <touching (ground v)?>> then\n            if <[0] = (Double Jump)> then\n                if <(Jump Height) = (jump)> then\n                    set [yvel v] to (Jump Height)\n                    start sound [Jump20 v]\n                end\n                change [jump v] by (-1)\n                change [yvel v] by (((Gravity) / (4)) * (3))\n            else\n                if <[0] = (spacepressed)> then\n                    set [yvel v] to (Jump Height)\n                    change [jump v] by (-1)\n                    set [spacepressed v] to [1]\n                end\n            end\n        end\n        change y by (-1)\n    end\nelse\n    if <[0] = (Double Jump)> then\n        set [jump v] to [0]\n    end\nend\nif <<<key (a v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>>> then\n    if <[0] = (move)> then\n        if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n            point in direction (90)\n            change [xvel v] by (Speed)\n        end\n        if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n            point in direction (-90)\n            change [xvel v] by ((0) - (Speed))\n        end\n    end\nelse\n    if <[0] = (move)> then\n        set [xvel v] to ((0.75) * (xVel))\n    end\nend\nset [xvel v] to ((0.7) * (xVel))\nchange x by (xVel)\nif <touching (ground v)?> then\n    change x by ((0) - (xVel))\n    set [xvel v] to [0]\n    if <not <(round (xVel)) = [0]>> then\n        if <[0] < (xVel)> then\n            change x by (1)\n            if <touching (ground v)?> then\n                change x by (-1)\n            else\n                change x by (1)\n                if <touching (ground v)?> then\n                    change x by (-1)\n                else\n                    change x by (1)\n                    if <touching (ground v)?> then\n                        change x by (-1)\n                    end\n                end\n            end\n        else\n            change x by (-1)\n            if <touching (ground v)?> then\n                change x by (1)\n            else\n                change x by (-1)\n                if <touching (ground v)?> then\n                    change x by (1)\n                else\n                    change x by (-1)\n                    if <touching (ground v)?> then\n                        change x by (1)\n                    end\n                end\n            end\n        end\n    end\nend\nif <<(xVel) < [.5]> and <[-.5] < (xVel)>> then\n    set [xvel v] to [0]\nend\nbroadcast (render v)\n\nif <<not <touching (portalb v)?>> and <not <touching (portalr v)?>>> then\n    set [j v] to [0]\nend\n\ndefine goUp\nrepeat until <not <touching (ground v)?>>\n    change y by (1)\nend\n\ndefine varReset\nset [d v] to [0]\nset [xvel v] to [0]\nset [yvel v] to [0]\nset [jump v] to [0]\nset [speed v] to [1]\nset [gravity v] to [.25]\nset [jump height v] to [5]\ngo to x: (-200) y: (-172)\n\nwhen I receive [die v]\nvarReset\n\ndefine goDown\nrepeat until <not <touching (ground v)?>>\n    change y by (-1)\nend\nchange y by (-1)\n\nwhen I receive [levelstart v]\nforever\n    Physics\n    if <(y position) < [-178]> then\n        broadcast (die v)\n    end\nend\n\nwhen I receive [level v]\nstop [other scripts in sprite v]\nvarReset\n\nwhen I receive [c 1 v]\nstop [other scripts in sprite v]\nwait (0.5) seconds\nbroadcast (levelstart v)\ngo to x: (c2_x) y: ((c2_y) + (17))\nset [yvel v] to [8]\n\nwhen I receive [c 2 v]\nstop [other scripts in sprite v]\nwait (0.5) seconds\nbroadcast (levelstart v)\ngo to x: (c1_x) y: ((c1_y) + (17))\nset [yvel v] to [8]\n\nwhen I receive [sleigh v]\nset [m v] to [0]\nwait (0.5) seconds\npoint in direction (-90)\nset [m v] to [1]\nrepeat until <(x position) < [-80]>\n    change [xvel v] by (-1)\nend\nset [m v] to [0]\nwait (0.5) seconds\npoint in direction (90)\nrepeat (7)\n    start sound [Jump20 v]\n    set [yvel v] to [5]\n    create clone of (present v)\n    wait (1.5) seconds\nend\nwait (0.5) seconds\nset [yvel v] to [5]\nstart sound [Jump20 v]\nrepeat (32)\n    change x by (2)\nend\nstop [other scripts in sprite v]\nbroadcast (s 2 v)\n\nwhen I receive [r v]\ngo to (sleigh v)\nchange y by (2)\nbroadcast (render v)\n\nset [ghost v] effect to (0)\ngo to [front v] layer\n\nstop [all v]\n\n@Santa\n\nwhen I receive [hide v]\nset [ghost v] effect to (0)\n\nwhen I receive [show v]\nset [ghost v] effect to (100)\n\nwhen I receive [render v]\ngo to (hitbox v)\npoint in direction ([direction v] of [hitbox v])\n\nwhen flag clicked\nshow\nforever\n    if <([ycollision v] of [hitbox v]) = [1]> then\n        if <[0] = (move)> then\n            if <<<key (a v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>>> then\n                next costume\n                if <[4] < (costume [number v])> then\n                    switch costume to (run2 v)\n                end\n                if <((costume [number v]) mod (2)) = [0]> then\n                    start sound [Hit_Hurt3 v]\n                end\n                wait (0.1) seconds\n            else\n                switch costume to (stand v)\n            end\n        else\n            if <[1] = (m)> then\n                next costume\n                if <[4] < (costume [number v])> then\n                    switch costume to (run2 v)\n                end\n                if <((costume [number v]) mod (2)) = [0]> then\n                    start sound [Hit_Hurt3 v]\n                end\n                wait (0.1) seconds\n            else\n                switch costume to (stand v)\n            end\n        end\n    else\n        switch costume to (jump up v)\n    end\nend\n\nwhen I receive [c 1 v]\nhide\nwait (0.5) seconds\nshow\n\nwhen I receive [c 2 v]\nhide\nwait (0.5) seconds\nshow\n\nwhen I receive [h v]\nhide\n\n@Ground\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\nswitch costume to (0 v)\nshow\nbroadcast (level v)\n\nwhen I receive [show v]\nset [ghost v] effect to (0)\n\nwhen I receive [level v]\nbroadcast (die v)\nnext costume\nbroadcast (level2 v)\n\nwhen I receive [hide v]\nset [ghost v] effect to (100)\n\nswitch costume to (3 v)\nbroadcast (level v)\n\nset [ghost v] effect to (0)\nshow\ngo to [front v] layer\n\n@Tileset\n\nwhen flag clicked\nset size to (100) %\n\ndefine render (made by JamesOuO)\nerase all\ngo to x: (-232) y: (-172)\nbroadcast (show v) and wait\nshow\nrepeat (23)\n    repeat (30)\n        switch costume to (1 v)\n        if <touching (ground v)?> then\n            if <touching color (#34009d)?> then\n                switch costume to (top v)\n                stamp\n            else\n                if <touching color (#000000)?> then\n                    switch costume to (brick v)\n                    stamp\n                else\n                    if <touching color (#666666)?> then\n                        switch costume to (window v)\n                        stamp\n                    else\n                        if <touching color (#006622)?> then\n                            switch costume to (top v)\n                            stamp\n                            switch costume to (present v)\n                            set [bricktype v] to [Present]\n                            create clone of (_myself_ v)\n                        else\n                            if <touching color (#7f7f7f)?> then\n                                switch costume to (top v)\n                                stamp\n                                switch costume to (spikes v)\n                                set [bricktype v] to [Spikes]\n                                create clone of (_myself_ v)\n                            else\n                                if <touching color (#66e8ff)?> then\n                                    switch costume to (top v)\n                                    stamp\n                                    switch costume to (chimney v)\n                                    set [bricktype v] to [Chimney]\n                                    set [c1_x v] to (x position)\n                                    set [c1_y v] to (y position)\n                                    create clone of (_myself_ v)\n                                else\n                                    if <touching color (#66adff)?> then\n                                        switch costume to (top v)\n                                        stamp\n                                        switch costume to (chimney2 v)\n                                        set [bricktype v] to [Chimney2]\n                                        set [c2_x v] to (x position)\n                                        set [c2_y v] to (y position)\n                                        create clone of (_myself_ v)\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change x by (16)\n    end\n    change y by (16)\n    set x to (-232)\nend\nhide\nbroadcast (hide v)\nbroadcast (levelstart v)\n\nswitch costume to (detect v)\nif <touching (ground v)?> then\n    switch costume to (brick v)\nelse\n    switch costume to (top v)\nend\n\nwhen I receive [level2 v]\nrender (made by JamesOuO)\n\nwhen I start as a clone\nif <(costume [name v]) = [Present]> then\n    forever\n        if <touching (hitbox v)?> then\n            broadcast (level v)\n        end\n    end\nelse\n    if <(costume [name v]) = [Spikes]> then\n        forever\n            if <touching (hitbox v)?> then\n                broadcast (die v)\n            end\n        end\n    else\n        if <(costume [name v]) = [Chimney]> then\n            forever\n                if <touching (hitbox v)?> then\n                    broadcast (c 1 v)\n                    wait until <not <touching (hitbox v)?>>\n                    wait (0.4) seconds\n                    wait until <touching (hitbox v)?>\n                end\n            end\n        else\n            if <(costume [name v]) = [Chimney2]> then\n                forever\n                    if <touching (hitbox v)?> then\n                        broadcast (c 2 v)\n                        wait until <not <touching (hitbox v)?>>\n                        wait (0.4) seconds\n                        wait until <touching (hitbox v)?>\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [level v]\ndelete this clone\n\nif <touching (ground v)?> then\n\nset [bricktype v] to [0]\n\nset pen color to (#bcbcbc)\n\nset drag mode [draggable v]\n\n@snow\n\nwhen flag clicked\nhide\nset [clones v] to [0]\nrepeat (55)\n    set y to (pick random (-180) to (180))\n    create clone of (_myself_ v)\nend\nset y to (182)\nforever\n    wait (pick random (0.1) to (0.25)) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nchange [clones v] by (1)\nset x to (pick random (-240) to (240))\nshow\nrepeat until <(y position) < [-179]>\n    change y by (-1)\n    change x by (pick random (-2) to (0))\n    if <(x position) < [-239]> then\n        set x to (240)\n    end\nend\nchange [clones v] by (-1)\ndelete this clone\n\n@Sleigh\n\nwhen flag clicked\nset [move v] to [0]\nhide\n\nwhen I receive [level2 v]\nif <[9] = ([costume # v] of [ground v])> then\n    switch costume to (1 v)\n    show\n    go to x: (-22) y: (-76)\n    wait until <touching (hitbox v)?>\n    set [move v] to [1]\n    broadcast (sleigh v)\nend\n\nwhen I receive [s 2 v]\nwait (0.5) seconds\nset [vel v] to [0]\nrepeat until <[230] < (x position)>\n    change [vel v] by (0.25)\n    change y by ((vel) / (2))\n    change x by (vel)\n    broadcast (r v)\nend\nbroadcast (h v)\nhide\nbroadcast (win v)\n\n@Present\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ngo to (santa v)\nchange x by (2)\nset [v v] to [6.75]\nshow\nrepeat (53)\n    change x by (1)\n    change y by (v)\n    change [v v] by (-0.25)\n    set size to ((100) - (([abs v] of (v) ) * (10))) %\n    turn right (5) degrees\nend\ndelete this clone\n\n@Text\n\nwhen I receive [widths v]\ndelete (all) of [width v]\nadd [5] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [2] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [1] to [width v]\nadd [2] to [width v]\nadd [3] to [width v]\nadd [1] to [width v]\nadd [5] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [2] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [5] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [1] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [3] to [width v]\nadd [5] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [3] to [width v]\nadd [4] to [width v]\nadd [5] to [width v]\nadd [8] to [width v]\nadd [4] to [width v]\nadd [5] to [width v]\nadd [4] to [width v]\nadd [1] to [width v]\nadd [2] to [width v]\nadd [2] to [width v]\nadd [1] to [width v]\nadd [4] to [width v]\nadd [5] to [width v]\nadd [3] to [width v]\nadd [3] to [width v]\nadd [4] to [width v]\nadd [2] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [4] to [width v]\nadd [1] to [width v]\n\nwhen I receive [win v]\nset [brightness v] effect to (100)\nwait (0.5) seconds\nprint [y\ou_win!] at x: (0) y: (120) size: (4) centered: (1)\nprint [c\hristmas_was_saved_for_those_7_specific_kids_thanks_to_you!] at x: (0) y: (80) size: (1) centered: (1)\nprint [a\s_for_all_those_other_children_who_missed_c\hristmas_due_to_your_waste_of_time...] at x: (0) y: (70) size: (1) centered: (1)\nprint [u\hh...] at x: (0) y: (60) size: (1) centered: (1)\nprint [t\hanks_for_playing!] at x: (0) y: (0) size: (1) centered: (1)\nprint [i\f_you_liked_this,_why_not_give_a_love_and_favorite?_:\)] at x: (0) y: (-10) size: (1) centered: (1)\nprint [f\ixed_by_e\vinor_13.11.2019] at x: (-30) y: (-30) size: (1) centered: (1)\n\ndefine None\nset size to ((size) * (100)) %\nif <[1] = (centered)> then\n    set [.. v] to [0]\n    set [. v] to [0]\n    set y to (y)\n    repeat until <(length of (text)) < ((.) + (1))>\n        change [. v] by (1)\n        switch costume to (letter (.) of (text))\n        if <[\] = (letter ((1) + (.)) of (text))> then\n            switch costume to (join (letter (.) of (text)) (letter (.) of (text)))\n        else\n        end\n        if <[\] = (letter ((1) + (.)) of (text))> then\n            change [. v] by (1)\n        end\n        change [.. v] by (((item (costume [number v]) of [width v]) + (1)) * (size))\n    end\n    hide\n    set x to ((0) - ((..) / (2)))\nelse\n    go to x: (x) y: (y)\nend\nset [. v] to [0]\nshow\nrepeat until <(length of (text)) < ((.) + (1))>\n    change [. v] by (1)\n    switch costume to (letter (.) of (text))\n    if <[\] = (letter ((1) + (.)) of (text))> then\n        switch costume to (join (letter (.) of (text)) (letter (.) of (text)))\n    else\n    end\n    if <not <[_] = (letter (.) of (text))>> then\n        stamp\n    end\n    change x by ((size) * ((item (costume [number v]) of [width v]) + (1)))\n    if <[\] = (letter ((1) + (.)) of (text))> then\n        change [. v] by (1)\n    end\nend\nhide\n\n@NES color palette\n\nwhen flag clicked\nhide\n\n@Thumbnail\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nset size to (1200) %\ngo to [front v] layer\n\nhide\n\n