Night -A Platformer-

Instructions: Arrow keys/wad/mobile to move.\nAvoid spikes.\nBounce on bouncies.\nSometimes there will be a sudden blackout! (I did that so that the game wouldn't be too generic)

@Stage\n\nwhen I receive [start v]\nset volume to (75) %\nforever\n    play sound [Unlimited v] until done\nend\n\n@Player\n\nwhen I receive [start v]\nset [level v] to [1]\ngo to x: (-212) y: (0)\nshow\nset [y v] to [0]\nset [x v] to [0]\nforever\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [x v] by (-1)\n    end\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [x v] by (1)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (level v)?> then\n        change y by (1)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change y by (1)\n                        if <touching (level v)?> then\n                            change y by (-5)\n                            change x by ((x) * (-1))\n                            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (20))>>> then\n                                if <(x) > [0]> then\n                                    set [x v] to [-8]\n                                else\n                                    set [x v] to [8]\n                                end\n                                set [y v] to [13]\n                            else\n                                set [x v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y v] by (-1)\n    change y by (y)\n    if <touching (level v)?> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <<<<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 v] to [15]\n    end\n    change y by (1)\n    if <(x position) > [220]> then\n        change [level v] by (1)\n        broadcast (NEXT LEVEL v)\n        go to x: (-212) y: (0)\n        set [y v] to [0]\n        set [x v] to [0]\n    end\n    if <(y position) < [-170]> then\n        go to x: (-212) y: (0)\n    end\n    if <touching (spikes v)?> then\n        go to x: (-212) y: (0)\n        set [y v] to [0]\n        set [x v] to [0]\n    end\n    if <touching (bounce v)?> then\n        set [y v] to [20]\n    end\nend\n\nwhen flag clicked\nshow\nbroadcast (begin v)\nset [level v] to [1]\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nset size to (97) %\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [start v]\nforever\n    create clone of (_myself_ v)\nend\n\n@Level\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nnext costume\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\nswitch costume to (1 v)\nshow\n\n@Spikes\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nnext costume\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\nswitch costume to (1 v)\nshow\n\n@Bounce\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (1 v)\nshow\n\nwhen I receive [next level v]\nnext costume\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\nwhen I receive [start v]\nrepeat (10)\n    erase all\nend\n\n@Sprite2\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\n\nwhen I receive [start v]\nforever\n    set [ghost v] effect to (100)\n    wait (pick random (1) to (8)) seconds\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\n    set [ghost v] effect to (0)\n    wait (.5) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\nend\n\n@intro\n\nwhen flag clicked\nset volume to (100) %\nstart sound [Super intro v]\nswitch costume to (screen shot 2020-07-06 at 3 v)\nset size to (100) %\nerase all\nhide\nset [ghost v] effect to (0)\npen up\ngo to x: (-231) y: (-240)\nset pen size to (100)\nset pen color to (#00f307)\npen down\nrepeat (3)\n    point in direction (0)\n    repeat (20)\n        move (20) steps\n    end\n    point in direction (90)\n    repeat (5)\n        move (20) steps\n    end\n    point in direction (180)\n    repeat (20)\n        move (20) steps\n    end\n    point in direction (90)\n    repeat (5)\n        move (20) steps\n    end\nend\npen up\nshow\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nset size to (200) %\npoint in direction (90)\nshow\nrepeat (20)\n    change size by (-10)\n    turn right (10) degrees\nend\nrepeat (10)\n    change size by (20)\n    turn right (10) degrees\nend\npoint in direction (90)\nrepeat (10)\n    change size by (-10)\nend\nwait (.5) seconds\nrepeat (20)\n    turn right (18) degrees\n    create clone of (_myself_ v)\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nerase all\nbroadcast (start v)\nerase all\ndelete this clone\n\nwhen flag clicked\nforever\n    set pen color to (#00f307)\n    wait (.5) seconds\n    repeat (17)\n        change pen (color v) by (-1)\n    end\n    set pen color to (#ffe900)\n    wait (.5) seconds\n    repeat (14)\n        change pen (color v) by (-1)\n    end\n    set pen color to (#ff0000)\n    wait (.5) seconds\n    repeat (32)\n        change pen (color v) by (1)\n    end\nend\n\nwhen I start as a clone\nswitch costume to (costume1 v)\nset pen size to (100)\nset pen color to (#ffffff)\npen down\nrepeat until <touching (_edge_ v)?>\n    move (15) steps\nend\ndelete this clone\n\n