Halloween - A Platformer

Instructions: Top loved 9/11/2020\nTop remixed 21/09/2020\nCONTROLS:\nArrow keys/WASD/Mobile Controls to move your player\nAvoid spikes, lava and saws.\nGet to the green flag to advance to the next level.\nBounce on trampolines.\nEnjoy the heavily decorated levels 

@Stage\n\nwhen flag clicked\nforever\n    play sound [musicy v] until done\nend\n\n@p\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nset [lvl v] to [1]\nforever\n    if <<key (b v) pressed?> or <touching (s2 v)?>> then\n        broadcast (die v)\n    end\n    if <(x position) > [242]> then\n        if <not <[] = [14]>> then\n            if <not <[] = [15]>> then\n                broadcast (lvl v)\n            end\n        end\n    end\n    if <(y position) < [-171]> then\n        broadcast (die v)\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (r v)\nset [ghost v] effect to (0)\nshow\ngo to x: (-180) y: (-50)\nset [lvl v] to [1]\nset [x? v] to [0]\nset [y?? v] to [0]\npoint in direction (90)\nforever\n    change [y?? v] by (-1)\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>> then\n        change [x? v] by (-0.8)\n        switch costume to (l v)\n    end\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        switch costume to (r v)\n        change [x? v] by (0.8)\n    end\n    set [x? v] to ((x?) * (0.9))\n    change x by (x?)\n    if <touching (g v)?> then\n        change y by (1)\n    end\n    if <touching (g v)?> then\n        change y by (1)\n    end\n    if <touching (g v)?> then\n        change y by (1)\n    end\n    if <touching (g v)?> then\n        change y by (1)\n    end\n    if <touching (g v)?> then\n        change y by (-4)\n        change x by ((x?) * (-1))\n        if <<<key (space v) pressed?> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            set [y?? v] to [10]\n            if <([abs v] of (x?) ) = (x?)> then\n                set [x? v] to [-5]\n            else\n                set [x? v] to [5]\n            end\n        else\n            set [x? v] to [0]\n        end\n    end\n    change y by (y??)\n    if <touching (g v)?> then\n        change y by ((0) - (y??))\n        set [y?? v] to [0]\n    end\n    change y by (-1)\n    if <<<<key (space v) pressed?> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> or <<mouse down?> and <(mouse y) > (y position)>>> and <touching (g v)?>> then\n        set [y?? v] to [15]\n    end\n    change y by (1)\n    if <(y position) > [180]> then\n        set [y?? v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\n    wait (0.01) seconds\nend\n\nwhen I start as a clone\nset [ghost v] effect to (70)\nrepeat (4)\n    wait (0.01) seconds\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen I receive [die v]\ngo to x: (-180) y: (-50)\n\nwhen I receive [lvl v]\nchange [lvl v] by (1)\ngo to x: (-180) y: (-50)\n\n@g\n\nwhen I receive [ed v]\nhide\n\nwhen flag clicked\nshow\nswitch costume to (1 v)\ngo to x: (0) y: (0)\n\nwhen flag clicked\ngo to [front v] layer\n\nbroadcast (lvl v)\n\ngo to x: (0) y: (100)\n\nwhen I receive [lvl v]\nnext costume\n\n@s2\n\nwhen flag clicked\nshow\nswitch costume to (1 v)\nforever\n    go to [back v] layer\nend\n\nbroadcast (lvl v)\n\nwhen I receive [lvl v]\nnext costume\n\n@tn\n\nwhen flag clicked\nhide\nforever\n    go to [front v] layer\nend\n\ngo to [front v] layer\n\n@sb\n\nwhen flag clicked\nshow\nswitch costume to (s v)\nset [d v] to [0]\ngo to x: (-195) y: (155)\nforever\n    if <touching (mouse-pointer v)?> then\n        if <not <(d) = [1]>> then\n            set [brightness v] effect to (30)\n            repeat until <(size) = [110]>\n                change size by (2.5)\n            end\n            if <mouse down?> then\n                if <not <(d) = [1]>> then\n                    if <not <(lvl) = [15]>> then\n                        broadcast (lvl v)\n                        broadcast (die v)\n                        set [d v] to [1]\n                        switch costume to (s2 v)\n                        clear graphic effects\n                        repeat until <(size) = [100]>\n                            wait (0.01) seconds\n                            change size by (-2.5)\n                        end\n                        wait (3) seconds\n                        set [d v] to [0]\n                        switch costume to (s v)\n                    end\n                end\n            end\n        end\n    else\n        clear graphic effects\n        repeat until <(size) = [100]>\n            change size by (-2.5)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n@s\n\nwhen I receive [lvl v]\nnext costume\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [14]> then\n        wait (0.5) seconds\n        next costume\n    end\n    if <(costume [number v]) = [15]> then\n        wait (0.5) seconds\n        switch costume to ((costume [number v]) - (1))\n    end\nend\n\nwhen flag clicked\nshow\nswitch costume to (1 v)\nclear graphic effects\nset [brightness v] effect to (-50)\nset [color v] effect to ((-5) * (2))\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\nbroadcast (lvl v)\n\n@r\n\nwhen flag clicked\nhide\ngo to x: (-6) y: (105)\n\nwhen flag clicked\nhide\ngo to [front v] layer\nforever\n    wait (pick random (15) to (20)) seconds\n    switch costume to (reminder v)\n    go to x: (0) y: (105)\n    show\n    go to [front v] layer\n    repeat (9)\n        change y by (-6)\n    end\n    repeat (5)\n        change y by (3)\n    end\n    repeat (5)\n        change y by (-1)\n    end\n    wait (2) seconds\n    repeat (15)\n        change y by (7)\n    end\n    hide\nend\n\nswitch costume to (reminder v)\ngo to x: (0) y: (105)\nshow\ngo to [front v] layer\nrepeat (9)\n    change y by (-6)\nend\nrepeat (5)\n    change y by (3)\nend\nrepeat (5)\n    change y by (-1)\nend\nwait (2) seconds\nrepeat (15)\n    change y by (7)\nend\nhide\n\n