Christmas: A Mobile Platformer

Instructions: A Christmas platformer, with a boss fight at the end! Move with the arrow keys or wasd, or tap if you're on mobile!\n\nM to mute. U to unmute!\n

@Stage\n\n@Character\n\nwhen flag clicked\nset [level v] to [1]\nhide variable [deaths v]\nhide variable [deaths v]\nset [deaths v] to [0]\nhide\ngo to x: (-212) y: (-129)\nswitch costume to (costume1 v)\nset size to (50) %\n\nwhen I receive [game start v]\nshow\nshow variable [deaths v]\nforever\n    if <touching color (#74c2c8)?> then\n        if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<(x position) < (mouse x)> and <mouse down?>>> then\n            switch costume to (costume1 v)\n            change [xv v] by (.7)\n        end\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<(mouse x) < (x position)> and <mouse down?>>> then\n            switch costume to (costume2 v)\n            change [xv v] by (-.7)\n        end\n        set [xv v] to ((Xv) * (.99))\n        change x by (Xv)\n        if <touching color (#f1f1f1)?> then\n            change y by (1)\n            if <touching color (#f1f1f1)?> then\n                change y by (1)\n                if <touching color (#f1f1f1)?> then\n                    change y by (1)\n                    if <touching color (#f1f1f1)?> then\n                        change y by (1)\n                        if <touching color (#f1f1f1)?> then\n                            change y by (1)\n                            if <touching color (#f1f1f1)?> then\n                                change x by ((Xv) * (-1))\n                                change y by (-5)\n                                if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(y position) < ((mouse y) + (-30))> and <mouse down?>>> then\n                                    if <(Xv) > [0]> then\n                                        set [xv v] to [-5]\n                                    else\n                                        set [xv v] to [5]\n                                    end\n                                    set [yv v] to [10]\n                                else\n                                    set [xv v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [yv v] by (-1)\n        change y by (Yv)\n        if <touching color (#f1f1f1)?> then\n            change y by ((Yv) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <touching color (#f1f1f1)?> then\n            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(y position) < ((mouse y) + (-30))> and <mouse down?>>> then\n                set [yv v] to [15]\n            end\n        end\n        change y by (1)\n    else\n        if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<(x position) < (mouse x)> and <mouse down?>>> then\n            switch costume to (costume1 v)\n            change [xv v] by (.7)\n        end\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<(mouse x) < (x position)> and <mouse down?>>> then\n            switch costume to (costume2 v)\n            change [xv v] by (-.7)\n        end\n        set [xv v] to ((Xv) * (.9))\n        change x by (Xv)\n        if <touching color (#f1f1f1)?> then\n            change y by (1)\n            if <touching color (#f1f1f1)?> then\n                change y by (1)\n                if <touching color (#f1f1f1)?> then\n                    change y by (1)\n                    if <touching color (#f1f1f1)?> then\n                        change y by (1)\n                        if <touching color (#f1f1f1)?> then\n                            change y by (1)\n                            if <touching color (#f1f1f1)?> then\n                                change x by ((Xv) * (-1))\n                                change y by (-5)\n                                if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(y position) < ((mouse y) + (-30))> and <mouse down?>>> then\n                                    if <(Xv) > [0]> then\n                                        set [xv v] to [-5]\n                                    else\n                                        set [xv v] to [5]\n                                    end\n                                    set [yv v] to [10]\n                                else\n                                    set [xv v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [yv v] by (-1)\n        change y by (Yv)\n        if <touching color (#f1f1f1)?> then\n            change y by ((Yv) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <touching color (#f1f1f1)?> then\n            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(y position) < ((mouse y) + (-30))> and <mouse down?>>> then\n                set [yv v] to [15]\n            end\n        end\n        change y by (1)\n    end\nend\n\nwhen I receive [game start v]\nforever\n    if <(x position) > [230]> then\n        go to x: (-212) y: (-129)\n        broadcast (Next level v)\n    end\n    if <touching color (#7aa4ba)?> then\n        change [deaths v] by (1)\n        go to x: (-212) y: (-129)\n    end\n    if <touching color (#0002dd)?> then\n        set [yv v] to [20]\n    end\n    if <key (r v) pressed?> then\n        go to x: (-212) y: (-129)\n    end\n    if <[15] < (Level)> then\n        broadcast (4 v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [next level v]\nchange [level v] by (1)\ngo to x: (-212) y: (-129)\n\nwhen I receive [4 v]\nhide\nhide variable [deaths v]\n\nwhen flag clicked\nstart sound [Masked Heroes v]\nforever\n    if <key (u v) pressed?> then\n        start sound [Masked Heroes v]\n    end\n    if <key (m v) pressed?> then\n        stop all sounds\n    end\nend\n\n@LEVEL\n\nwhen flag clicked\ngo to [back v] layer\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\n\nwhen I receive [next level v]\nnext costume\n\nwhen I receive [3 v]\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\n\n@Sprite1\n\nwhen I start as a clone\nshow\ngo to [front v] layer\nset size to (60) %\ngo to x: (pick random (-227) to (229)) y: (172)\npoint in direction (180)\nforever\n    move (10) steps\n    if <touching (_edge_ v)?> then\n        delete this clone\n    end\nend\n\nwhen I receive [start v]\nhide\nforever\n    create clone of (_myself_ v)\n    wait (.05) seconds\nend\n\n@Dad\n\nwhen I receive [1 v]\nstop [other scripts in sprite v]\nglide (1) secs to x: (32) y: (-70)\nforever\n    if <touching (sprite2 v)?> then\n        forever\n            go to (sprite2 v)\n        end\n    end\nend\n\nwhen I receive [2 v]\nhide\n\nwhen I receive [start v]\ngo to x: (32) y: (-70)\nshow\nwait (.2) seconds\nforever\n    glide (1) secs to x: (32) y: (-21)\n    glide (1) secs to x: (32) y: (-70)\nend\n\n@Mom\n\nwhen I receive [1 v]\nstop [other scripts in sprite v]\nglide (1) secs to x: (161) y: (-105)\nforever\n    if <touching (sprite2 v)?> then\n        forever\n            go to (sprite2 v)\n        end\n    end\nend\n\nwhen I receive [2 v]\nhide\n\nwhen I receive [start v]\nset size to (83) %\ngo to x: (161) y: (-105)\nshow\nwait (.6) seconds\nforever\n    glide (1) secs to x: (161) y: (-55)\n    glide (1) secs to x: (161) y: (-105)\nend\n\n@Sister\n\nwhen I receive [1 v]\nstop [other scripts in sprite v]\nglide (1) secs to x: (-78) y: (-120)\nforever\n    if <touching (sprite2 v)?> then\n        forever\n            go to (sprite2 v)\n        end\n    end\nend\n\nwhen I receive [2 v]\nhide\n\nwhen I receive [start v]\nset size to (65) %\nshow\ngo to x: (-78) y: (-120)\nforever\n    glide (1) secs to x: (-78) y: (-67)\n    glide (1) secs to x: (-78) y: (-120)\nend\n\n@Scratch Cat\n\nwhen I receive [1 v]\nstop [other scripts in sprite v]\nglide (1) secs to x: (-152) y: (-134)\n\nwhen I receive [2 v]\nswitch costume to (costume2 v)\n\nwhen I receive [game start v]\nhide\n\nwhen I receive [start v]\nswitch costume to (costume1 v)\nset size to (50) %\ngo to x: (-152) y: (-134)\nshow\nwait (1) seconds\nforever\n    glide (1) secs to x: (-152) y: (-55)\n    glide (1) secs to x: (-152) y: (-134)\nend\n\n@Talking\n\nwhen I receive [2 v]\nswitch costume to (costume3 v)\nrepeat (100)\n    change [ghost v] effect by (-1)\nend\nwait (1) seconds\nrepeat (100)\n    change [ghost v] effect by (1)\nend\nwait (1) seconds\nswitch costume to (costume4 v)\nrepeat (100)\n    change [ghost v] effect by (-1)\nend\nwait (1) seconds\nrepeat (100)\n    change [ghost v] effect by (1)\nend\nbroadcast (Game Start v)\nhide\n\nwhen I receive [4 v]\nshow\ngo to [front v] layer\nswitch costume to (costume5 v)\nrepeat (100)\n    change [ghost v] effect by (-1)\nend\nwait (1) seconds\nrepeat (100)\n    change [ghost v] effect by (1)\nend\nbroadcast (3 v)\nhide\n\nwhen I receive [end game v]\nhide variable [grinch lives v]\nhide variable [lives v]\n\nwhen flag clicked\nforever\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\nshow\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nrepeat (100)\n    change [ghost v] effect by (-1)\nend\nwait (1) seconds\nrepeat (100)\n    change [ghost v] effect by (1)\nend\nwait (1) seconds\nswitch costume to (costume2 v)\nrepeat (100)\n    change [ghost v] effect by (-1)\nend\nwait (1) seconds\nrepeat (100)\n    change [ghost v] effect by (1)\nend\nbroadcast (1 v)\n\n@Sprite2\n\nwhen flag clicked\nhide\nset size to (50) %\ngo to x: (230) y: (-74)\n\nwhen I receive [1 v]\nswitch costume to (grinch_movie_character_2018 v)\nwait (1) seconds\nshow\nglide (1) secs to x: (200) y: (-117)\nwait (1) seconds\nglide (1) secs to x: (71) y: (-92)\nwait (1) seconds\nglide (1) secs to x: (-42) y: (-142)\nswitch costume to (grinch_movie_character_2 v)\nwait (1) seconds\nglide (1) secs to x: (238) y: (-128)\nbroadcast (2 v)\nhide\n\n@Sprite3\n\nwhen flag clicked\nhide\n\nwhen I receive [game start v]\nshow\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (Next level v)\n        wait (2) seconds\n    end\nend\n\nwhen I receive [4 v]\nhide\n\n@Grinch_movie_character_2018\n\nwhen flag clicked\nhide variable [grinch lives v]\nset [costume v] to [1]\nswitch costume to (grinch_movie_character_2018 v)\nhide\n\nwhen I receive [3 v]\nwait (1) seconds\nset [grinch lives v] to [75]\nshow variable [grinch lives v]\nset size to (40) %\nshow\ngo to x: (0) y: (0)\nforever\n    point towards (mouse-pointer v)\n    move (2) steps\nend\n\nwhen I receive [3 v]\nwait (1) seconds\nforever\n    wait (pick random (7) to (12)) seconds\n    switch costume to (grinch_movie_character_2 v)\n    set [costume v] to [2]\n    wait (2) seconds\n    switch costume to (grinch_movie_character_2018 v)\n    set [costume v] to [1]\nend\n\nwhen I receive [3 v]\nforever\n    if <<touching (character 1 v)?> and <(costume) = [1]>> then\n        broadcast (Again v)\n        change [lives v] by (-1)\n    end\n    if <<touching (character 1 v)?> and <(costume) = [2]>> then\n        broadcast (Again 1 v)\n        change [grinch lives v] by (-1)\n    end\nend\n\n@Character 1\n\nwhen flag clicked\ngo to x: (50) y: (90)\nhide variable [lives v]\nhide\nset size to (40) %\n\nwhen I receive [3 v]\nwait (1) seconds\nshow\nset [lives v] to [20]\nshow variable [lives v]\nhide variable [deaths v]\nforever\n    if <touching (grinch_movie_character_2018 v)?> then\n        broadcast (5 v)\n    end\nend\n\nwhen I receive [3 v]\nwait (1) seconds\nforever\n    if <(Lives) < [1]> then\n        broadcast (3 v)\n    end\n    if <(Grinch Lives) < [1]> then\n        broadcast (End game v)\n    end\nend\n\nwhen I receive [3 v]\nforever\n    go to (mouse-pointer v)\n    point towards (mouse-pointer v)\nend\n\n@Sprite4\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\n\nwhen I receive [end game v]\nshow\nwait (5) seconds\nbroadcast (END v)\n\n@Sprite5\n\nwhen flag clicked\nset [1 v] to [0]\nforever\n    go to [front v] layer\n    show\n    go to x: (0) y: (0)\n    set [ghost v] effect to (100)\n    if <(1) = [1]> then\n        stop [this script v]\n    end\nend\n\nwhen I receive [end v]\nset [1 v] to [1]\ngo to [front v] layer\nshow\nset [ghost v] effect to (0)\nstop [all v]\n\n@download (5)\n\ndefine Set up (code)\npoint in direction (90)\nset [code v] to (code)\nswitch costume to (logo v)\nset size to (75) %\nshow\n\ndefine Glide type: (c)\nif <(c) = [1]> then\n    Glide to X: (-100) Y: (0)\nelse\n    if <(c) = [2]> then\n        Glide to X: (100) Y: (0)\n    else\n        if <(c) = [3]> then\n            Glide to X: (0) Y: (100)\n        else\n            if <(c) = [4]> then\n                Glide to X: (0) Y: (-100)\n            end\n        end\n    end\nend\n\ndefine Exit type (d)\nif <(d) = [1]> then\n    Glide size to (0) [yes]\nelse\n    if <(d) = [2]> then\n        set [y v] to [0]\n        repeat until <touching (_edge_ v)?>\n            change y by (Y)\n            change [y v] by (-1.5)\n        end\n        set [y v] to (() - ((Y) * (0.85)))\n        repeat until <(y position) < [-180]>\n            change y by (Y)\n            change [y v] by (-1.5)\n        end\n    else\n        Glide size to (0) [yus]\n    end\nend\n\ndefine Make clone detailed (z)\nset [x v] to (z)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(letter (1) of (X)) = [1]> then\n    switch costume to (words v)\n    Start type (letter (2) of (X))\n    wait (0) seconds\n    Exit type (letter (3) of (X))\n    delete this clone\nend\n\nwhen flag clicked\nstart sound [sound2 v]\nSet up (331)\nStart type (letter (1) of (Code))\nwait (1) seconds\nMake clone detailed (153)\nGlide type: (letter (2) of (Code))\nwait (1) seconds\nExit type (letter (3) of (Code))\nhide\nwait (1) seconds\nbroadcast (Start v)\n\ndefine Glide to X: (x) Y: (y)\nrepeat (25)\n    change x by (((x) - (x position)) / (8))\n    change y by (((y) - (y position)) / (8))\nend\n\ndefine Glide size to (b) (fade?)\nif <(fade?) = [yes]> then\n    set [ghost v] effect to (0)\n    repeat (10)\n        change size by (-10)\n        change [ghost v] effect by (10)\n    end\nelse\n    if <(fade?) = [yus]> then\n        set [ghost v] effect to (0)\n        repeat (10)\n            change size by (-10)\n            change [ghost v] effect by (10)\n            turn right (15) degrees\n        end\n    else\n        repeat (30)\n            change size by (((b) - (size)) / (8))\n        end\n    end\nend\n\ndefine Start type (a)\nif <(a) = [1]> then\n    go to x: (-300) y: (0)\n    repeat (30)\n        change x by (((4) - (x position)) / (8))\n    end\nelse\n    if <(a) = [2]> then\n        go to x: (300) y: (0)\n        repeat (30)\n            change x by (((-4) - (x position)) / (8))\n        end\n    else\n        if <(a) = [3]> then\n            go to x: (0) y: (240)\n            repeat (30)\n                change y by (((-3) - (y position)) / (8))\n            end\n        else\n            if <(a) = [4]> then\n                go to x: (0) y: (-240)\n                repeat (30)\n                    change y by (((3) - (y position)) / (8))\n                end\n            else\n                if <(a) = [4]> then\n                    go to x: (0) y: (-240)\n                    repeat (30)\n                        change y by (((3) - (y position)) / (8))\n                    end\n                else\n                    if <(a) = [5]> then\n                        go to x: (0) y: (0)\n                        set size to (0) %\n                        Glide size to (102) [no]\n                    end\n                end\n            end\n        end\n    end\nend\n\n@Sprite6\n\nwhen flag clicked\nshow\n\nwhen I receive [start v]\nhide\n\n