Scratch Day - A Mario Style Platformer v1.0
@Stage\n\nwhen flag clicked\nwait (0.1) seconds\nset [game_level v] to [1]\nswitch backdrop to (sky v)\nbroadcast (StartGame v)\nbroadcast (NewLevel v)\nforever\n    play sound [BBC Big Band - Caravan my-free-mp3s v] until done\nend\n\nwhen I receive [nextlevel v]\nchange [game_level v] by (1)\nbroadcast (NewLevel v)\n\nwhen I receive [startgame v]\nwait (0.1) seconds\nset [game_level v] to [1]\n\nwhen flag clicked\nforever\n    switch backdrop to (Game_Level)\nend\n\n@Player\n\nwhen flag clicked\nset rotation style [left-right v]\nforever\n    set [walk_frame v] to [2]\n    wait (0.03) seconds\n    repeat (6)\n        change [walk_frame v] by (1)\n        wait (0.03) seconds\n    end\nend\n\nwhen I receive [fall v]\nhide\n\nwhen I receive [startgame v]\nshow\nset rotation style [left-right v]\nforever\n    go to (hitbox v)\n    set size to (50) %\n    point in direction ([direction v] of [hitbox v])\n    if <(PowerUp) = [1]> then\n        set size to (80) %\n    end\n    switch costume to (stand v)\n    if <([abs v] of ([xv v] of [groundhitbox v]) ) > [1]> then\n        switch costume to (Walk_Frame)\n    end\n    if <<<key (s v) pressed?> or <key (down arrow v) pressed?>> or <<mouse down?> and <(mouse y) < ((y position) - (30))>>> then\n        switch costume to (crouch v)\n    end\n    if <(In-Air) > [0]> then\n        switch costume to (jump v)\n    end\n    change y by (6)\n    if <(Ouch?) = [true]> then\n        switch costume to (ow v)\n    end\n    if <(Flames?) = [true]> then\n        set [color v] effect to (-20)\n    else\n        set [color v] effect to (0)\n    end\nend\n\nwhen I receive [newlevel v]\nshow\n\nwhen I receive [ouchonleft v]\nrepeat (5)\n    set [ghost v] effect to (100)\n    wait (0.1) seconds\n    set [ghost v] effect to (0)\n    wait (0.1) seconds\nend\n\nwhen I receive [ouchonright v]\nrepeat (5)\n    set [ghost v] effect to (100)\n    wait (0.1) seconds\n    set [ghost v] effect to (0)\n    wait (0.1) seconds\nend\n\nwhen I receive [fall v]\nwait (0.3) seconds\nrepeat (5)\n    set [ghost v] effect to (100)\n    wait (0.1) seconds\n    set [ghost v] effect to (0)\n    wait (0.1) seconds\nend\n\n@End\n\nwhen I start as a clone\nforever\n    go to x: (([x position v] of [groundhitbox v]) + ((EndX) * (48))) y: (([y position v] of [groundhitbox v]) + ((EndY) * (36)))\n    point in direction (105)\n    if <touching (_edge_ v)?> then\n        hide\n    else\n        show\n    end\n    if <(Score) < ([numberofcoinsinlevel v] of [coins v])> then\n        set [brightness v] effect to (50)\n        set [color v] effect to ((1) / (0))\n        set [ghost v] effect to (50)\n        if <(distance to [hitbox v]) < [60]> then\n            say [You need to collect all coins before you can complete the level.]\n        else\n            say []\n        end\n    else\n        clear graphic effects\n        if <touching (hitbox v)?> then\n            broadcast (nextLevel v)\n            wait (0.01) seconds\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    switch costume to (green flag v)\n    wait (0.04) seconds\n    repeat (7)\n        next costume\n        wait (0.04) seconds\n    end\nend\n\nwhen I receive [newlevel v]\nrepeat (1)\n    delete this clone\nend\nif <(Game_Level) = [1]> then\n    set [endy v] to [-75]\n    set [endx v] to [4]\n    create clone of (_myself_ v)\n    hide\nend\nif <(Game_Level) = [2]> then\n    set [endy v] to [-76]\n    set [endx v] to [0.2]\n    create clone of (_myself_ v)\n    hide\nend\nif <(Game_Level) = [3]> then\n    set [endy v] to [-75]\n    set [endx v] to [43.5]\n    create clone of (_myself_ v)\n    hide\nend\n\nwhen I receive [nextlevel v]\ndelete this clone\n\ngo to x: (([x position v] of [groundhitbox v]) + ((EndX) * (48))) y: (([y position v] of [groundhitbox v]) + ((EndY) * (36)))\n\n@GroundHitbox\n\nwhen I receive [enemydie v]\nset [yv v] to [-12]\n\nwhen flag clicked\nhide\n\nwhen I receive [ouchonleft v]\nset [ouch? v] to [true]\nrepeat (10)\n    change [xv v] by (-2.5)\nend\nwait (0.3) seconds\nset [ouch? v] to [false]\n\nwhen I receive [ouchonright v]\nset [ouch? v] to [true]\nrepeat (10)\n    change [xv v] by (2.5)\nend\nwait (0.3) seconds\nset [ouch? v] to [false]\n\nwhen I receive [newlevel v]\ngo to x: (3401) y: (2735)\nset [yv v] to [0]\nset [ouch? v] to [false]\nswitch costume to (superzoom v)\nset size to (1700) %\nshow\ngo to x: (3401) y: (2735)\nforever\n    go to [back v] layer\n    set rotation style [don't rotate v]\n    switch costume to (Game_Level)\n    set [ghost v] effect to (0)\n    if <<<(Ouch?) = [false]> and <<not <key (down arrow v) pressed?>> and <not <key (s v) pressed?>>>> and <not <<mouse down?> and <(mouse y) < (([y position v] of [hitbox v]) - (30))>>>> then\n        if <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > [30]>>> and <not <<key (left arrow v) pressed?> or <key (a v) pressed?>>>> then\n            change [xv v] by (-2.5)\n        end\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < [-30]>>> then\n            change [xv v] by (2.5)\n        end\n    end\n    set [xv v] to ((XV) * (0.8))\n    change x by (XV)\n    if <touching (hitbox v)?> then\n        change y by (-1)\n        if <touching (hitbox v)?> then\n            change y by (-1)\n            if <touching (hitbox v)?> then\n                change y by (-1)\n                if <touching (hitbox v)?> then\n                    change y by (-1)\n                    if <touching (hitbox v)?> then\n                        change y by (-1)\n                        if <touching (hitbox v)?> then\n                            change x by ((XV) * (-1))\n                            change y by (5)\n                        end\n                    end\n                end\n            end\n        end\n    end\n    if <(YV) < [30]> then\n        change [yv v] by (1)\n    end\n    change y by (YV)\n    change [in-air v] by (1)\n    if <touching (hitbox v)?> then\n        change y by ((YV) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (1)\n    if <touching (hitbox v)?> then\n        set [in-air v] to [0]\n    end\n    change y by (-1)\n    set rotation style [left-right v]\n    set y to (2715)\nend\n\nwhen flag clicked\nforever\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (40))>>> then\n        if <(Water?) = [true]> then\n            set [in-air v] to [0.2]\n        end\n        wait until <not <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (40))>>>>\n    end\nend\n\nwhen flag clicked\ngo to x: (3401) y: (2735)\nset x to (3400)\n\nwhen I receive [newlevel v]\nrepeat (10)\n    go to x: (3401) y: (2735)\nend\n\n@Blocks\n\nwhen I start as a clone\nshow\nrepeat until <touching (hitbox v)?>\n    set size to (200) %\n    go to x: (([x position v] of [groundhitbox v]) + ((BlockX) * (48))) y: (([y position v] of [groundhitbox v]) + ((BlockY) * (36)))\n    if <touching (_edge_ v)?> then\n        hide\n    end\n    point in direction ((([sin v] of ((Bounce) + (-50)) ) * (5)) + (90))\n    set size to ((([sin v] of (Bounce) ) * (-5)) + (70)) %\n    show\n    change [bounce v] by (15)\nend\nstart sound [Connect v]\nif <(costume [number v]) = [1]> then\n    set [powerup v] to [1]\nelse\n    if <(costume [number v]) = [2]> then\n        set [powerup v] to [2]\n        set [flames? v] to [true]\n    end\n    delete this clone\nend\ndelete this clone\n\ndefine Block at X (x) Y (y) (block#)\nswitch costume to (block#)\nset [blockx v] to (x)\nset [blocky v] to (y)\ncreate clone of (_myself_ v)\nhide\n\nwhen I receive [startgame v]\nrepeat (1)\n    delete this clone\nend\nwait (0.1) seconds\n\ngo to x: (([x position v] of [groundhitbox v]) + ((BlockX) * (48))) y: (([y position v] of [groundhitbox v]) + ((BlockY) * (36)))\n\nwhen I receive [newlevel v]\nset [flames? v] to [false]\nset [powerup v] to [0]\nrepeat (1)\n    delete this clone\nend\nif <(Game_Level) = [1]> then\nif <(Game_Level) = [2]> then\n    Block at X [-40] Y [-73] [1]\nend\nif <(Game_Level) = [3]> then\n    Block at X [-30] Y [-78] [2]\nend\n\ngo to x: (([x position v] of [groundhitbox v]) + ((BlockX) * (48))) y: (([y position v] of [groundhitbox v]) + ((BlockY) * (36)))\n\n@Enemy\n\ndefine Glitch at X (x) Y (y) Territory? (size) (direction)\nset [enemytype? v] to [1]\nset [enemyx v] to (x)\nset [enemyy v] to (y)\nset [territory v] to (size)\nset [enemydirection v] to (direction)\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nshow\nforever\n    set size to (50) %\n    go to x: (([x position v] of [groundhitbox v]) + ((EnemyX) * (48))) y: (([y position v] of [groundhitbox v]) + ((EnemyY) * (36)))\n    if <touching (_edge_ v)?> then\n        hide\n    else\n        show\n    end\n    if <(EnemyType?) = [1]> then\n        if <(Dead?) = [true]> then\n            switch costume to (glitchsquish v)\n        end\n    end\nend\n\nwhen I receive [newlevel v]\nrepeat (1)\n    delete this clone\nend\nhide\nif <(Game_Level) = [1]> then\n    Glitch at X [-37] Y [-78.3] Territory? [116] [-90]\n    Glitch at X [-2] Y [-79.25] Territory? [525] [-90]\n    Glitch at X [-28] Y [-79.25] Territory? [525] [90]\nend\nif <(Game_Level) = [2]> then\n    Glitch at X [-46] Y [-79.3] Territory? [70] [-90]\n    Glitch at X [-49.2] Y [-79.3] Territory? [70] [90]\n    wait (0.3) seconds\n    Glitch at X [-46] Y [-79.3] Territory? [70] [-90]\n    Glitch at X [-49.2] Y [-79.3] Territory? [70] [90]\n    wait (0.3) seconds\nend\nif <(Game_Level) = [3]> then\n    Glitch at X [-84.4] Y [-78.8] Territory? [265] [90]\n    repeat (13)\n        Glitch at X [-25] Y [-78.5] Territory? [240] [90]\n    end\nend\n\nwhen I start as a clone\nset [dead? v] to [false]\nif <(EnemyType?) = [1]> then\n    clear graphic effects\n    repeat until <<<<<touching (hitbox v)?> and <([y position v] of [hitbox v]) > ((y position) + (5))>> and <([yv v] of [groundhitbox v]) > [-3]>> or <<(distance to [hitbox v]) < [60]> and <(PowerUp) = [1]>>> or <touching (fireball v)?>>\n        set rotation style [all around v]\n        if <<touching (hitbox v)?> and <not <([y position v] of [hitbox v]) > ((y position) + (10))>>> then\n            if <([x position v] of [hitbox v]) < (x position)> then\n                broadcast (OuchOnRight v)\n                wait (0.3) seconds\n            else\n                broadcast (OuchOnLeft v)\n                wait (0.3) seconds\n            end\n        end\n    end\n    start sound [Pluck v]\n    set [dead? v] to [true]\n    broadcast (BerryEnemy v)\n    switch costume to (glitchsquish v)\n    point in direction (90)\n    wait (0.05) seconds\n    broadcast (EnemyDie v)\n    wait (0.4) seconds\n    repeat (5)\n        change [ghost v] effect by (20)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nset rotation style [left-right v]\nwait (pick random (0) to (3)) seconds\nforever\n    if <(EnemyType?) = [1]> then\n        if <(EnemyDirection) = [90]> then\n            repeat (Territory)\n                if <(Dead?) = [false]> then\n                    change [enemyx v] by (0.05)\n                    turn left (-15) degrees\n                end\n            end\n        end\n        if <(Dead?) = [false]> then\n            set [enemydirection v] to [-90]\n        end\n        if <(EnemyDirection) = [-90]> then\n            repeat (Territory)\n                if <(Dead?) = [false]> then\n                    change [enemyx v] by (-0.05)\n                    turn left (15) degrees\n                end\n            end\n        end\n        if <(Dead?) = [false]> then\n            set [enemydirection v] to [90]\n        end\n    end\nend\n\nGlitch at X [-2.6] Y [-4] Territory? [56] [-90]\nwait (1.35) seconds\n\nwhen I start as a clone\nshow\nforever\n    if <(EnemyType?) = [1]> then\n        if <(Dead?) = [false]> then\n            switch costume to (glitch1 v)\n            if <(Dead?) = [true]> then\n                switch costume to (glitchsquish v)\n            end\n            wait (0.3) seconds\n            next costume\n            if <(Dead?) = [true]> then\n                switch costume to (glitchsquish v)\n            end\n            wait (0.3) seconds\n        end\n        if <(Dead?) = [true]> then\n            switch costume to (glitchsquish v)\n        end\n    end\nend\n\n@Level\n\nwhen I receive [startgame v]\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\nforever\n    go to (groundhitbox v)\n    switch costume to ([costume # v] of [groundhitbox v])\nend\n\n@Story\n\n@Coins\n\nwhen I start as a clone\nshow\nforever\n    set size to (200) %\n    go to x: (([x position v] of [groundhitbox v]) + ((CoinX) * (48))) y: (([y position v] of [groundhitbox v]) + ((CoinY) * (36)))\n    if <touching (_edge_ v)?> then\n        hide\n    else\n        if <touching (hitbox v)?> then\n            start sound [Coin v]\n            change [score v] by (1)\n            delete this clone\n        else\n            show\n        end\n    end\nend\n\ndefine Coin at X (x) Y (y)\nset [coinx v] to (x)\nset [coiny v] to (y)\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nforever\n    next costume\n    if <(costume [number v]) > [6]> then\n        switch costume to (costume1 v)\n    end\n    wait (0.07) seconds\nend\n\nwhen I receive [newlevel v]\nrepeat (1)\n    delete this clone\nend\nset [score v] to [0]\nif <(Game_Level) = [1]> then\n    set [numberofcoinsinlevel v] to [10]\n    Coin at X [-75] Y [-75.5]\n    Coin at X [-69] Y [-75.5]\n    Coin at X [-53.5] Y [-75.5]\n    Coin at X [-44.5] Y [-75.5]\n    Coin at X [-35.5] Y [-75.5]\n    Coin at X [-5] Y [-72]\n    Coin at X [-10.4] Y [-72]\n    Coin at X [3] Y [-78.8]\n    Coin at X [1] Y [-78.8]\n    Coin at X [2] Y [-78.8]\nend\nif <(Game_Level) = [2]> then\n    set [numberofcoinsinlevel v] to [6]\n    Coin at X [-69.1] Y [-72.7]\n    Coin at X [-45.1] Y [-72.7]\n    Coin at X [-48.5] Y [-79]\n    Coin at X [-47] Y [-79]\n    Coin at X [-44.1] Y [-75.7]\n    Coin at X [-42.3] Y [-75.7]\nend\nif <(Game_Level) = [3]> then\n    set [numberofcoinsinlevel v] to [12]\n    Coin at X [-71] Y [-78.3]\n    Coin at X [-10] Y [-75]\n    Coin at X [-1.9] Y [-75]\n    Coin at X [-6] Y [-73]\n    Coin at X [4] Y [-74.4]\n    Coin at X [5.4] Y [-76]\n    Coin at X [5.4] Y [-72]\n    Coin at X [19] Y [-72.8]\n    Coin at X [15.2] Y [-72.8]\n    Coin at X [22.6] Y [-79]\n    Coin at X [27] Y [-79]\n    Coin at X [27] Y [-72]\nend\n\nwhen I receive [startgame v]\nforever\n    set [coinscollected v] to (Score)\n    set [coinscollected v] to (join (Score) (join [ / ] (NumberOfCoinsInLevel)))\nend\n\nwhen I receive [newlevel v]\nset [score v] to [0]\n\nwhen I receive [nextlevel v]\nhide variable [coinscollected v]\nwait (2) seconds\nshow variable [coinscollected v]\n\nwhen I receive [startgame v]\nshow variable [coinscollected v]\n\nwhen [timer v] > (0.2)\nhide variable [coinscollected v]\n\n@Hitbox\n\nwhen I receive [startgame v]\nforever\n    set [ghost v] effect to (99)\n    set rotation style [don't rotate v]\n    switch costume to (hitbox v)\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > [30]>>> then\n        switch costume to (hitbox2 v)\n        point in direction (90)\n    else\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < [-30]>>> then\n            switch costume to (hitbox3 v)\n            point in direction (-90)\n        end\n    end\n    if <<<key (s v) pressed?> or <key (down arrow v) pressed?>> or <<mouse down?> and <(mouse y) < ((y position) - (30))>>> then\n        switch costume to (crouch v)\n    end\n    if <(In-Air) > [0]> then\n        switch costume to (hitbox v)\n    end\nend\n\nwhen I receive [ouchonleft v]\nset [yv v] to [13]\nplay sound [Ow v] until done\n\nwhen I receive [ouchonright v]\nset [yv v] to [13]\nplay sound [Ow v] until done\n\nwhen I receive [startgame v]\ngo to x: (0) y: (0)\nforever\n    if <(y position) < [-200]> then\n        broadcast (fall v)\n    end\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\nwhen I receive [newlevel v]\nset [yv v] to [0]\ngo to x: (0) y: (0)\nhide\nset size to (40) %\nforever\n    show\n    if <touching (groundhitbox v)?> then\n        change y by (1)\n        if <touching (groundhitbox v)?> then\n            change y by (1)\n            if <touching (groundhitbox v)?> then\n                change y by (1)\n                if <touching (groundhitbox v)?> then\n                    change y by (1)\n                    if <touching (groundhitbox v)?> then\n                        change y by (1)\n                        if <touching (groundhitbox v)?> then\n                            change y by (-5)\n                        end\n                    end\n                end\n            end\n        end\n    end\n    if <(Water?) = [true]> then\n        if <not <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (40))>>> and <(In-Air) < [8]>>> then\n            set [yv v] to [-2]\n        end\n    else\n        change [yv v] by (-1)\n    end\n    change y by (YV)\n    if <touching (groundhitbox v)?> then\n        change y by ((YV) * (-1))\n        set [yv 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) + (40))>>> and <(In-Air) < [8]>> then\n        if <(Water?) = [true]> then\n            set [yv v] to [9]\n        else\n            set [yv v] to [13]\n        end\n    end\n    change y by (1)\n    set rotation style [left-right v]\n    set x to (0)\n    if <touching (water v)?> then\n        set [water? v] to [true]\n    else\n        set [water? v] to [false]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Water?) = [true]> then\n        play sound [Bubbles v] until done\n    end\nend\n\n@Not used\n\nwhen flag clicked\nhide\n\nwhen I receive [intro v]\nshow\nset [animationspeed? v] to [0.06]\nclear graphic effects\nswitch costume to (intro1 v)\nwait ((AnimationSpeed?) * (29)) seconds\nplay sound [Footsteps v] until done\nrepeat (6)\n    next costume\n    wait (AnimationSpeed?) seconds\nend\nwait ((AnimationSpeed?) * (8.7)) seconds\nswitch costume to (intro8 v)\nwait ((AnimationSpeed?) * (4.35)) seconds\nrepeat (2)\n    next costume\n    wait ((AnimationSpeed?) * (6)) seconds\nend\nwait ((AnimationSpeed?) * (8)) seconds\nswitch costume to (intro11 v)\nwait ((AnimationSpeed?) * (15)) seconds\nswitch costume to (intro12 v)\nwait ((AnimationSpeed?) * (7.5)) seconds\nstart sound [Whiz v]\nrepeat (5)\n    next costume\n    wait (AnimationSpeed?) seconds\nend\nwait ((AnimationSpeed?) * (15)) seconds\nrepeat (7)\n    next costume\n    wait (AnimationSpeed?) seconds\nend\nswitch costume to (intro24 v)\nwait ((AnimationSpeed?) * (6)) seconds\nrepeat (6)\n    next costume\n    wait ((AnimationSpeed?) * (3)) seconds\nend\nwait ((AnimationSpeed?) * (20)) seconds\nrepeat (2)\n    next costume\n    wait ((AnimationSpeed?) * (3)) seconds\nend\nwait ((AnimationSpeed?) * (20)) seconds\nrepeat (7)\n    next costume\n    if <(costume [number v]) = [36]> then\n        start sound [Bonk v]\n    end\n    wait ((AnimationSpeed?) * (3)) seconds\nend\nwait (1) seconds\nstart sound [Teleport v]\nnext costume\nset [pixelate v] effect to (800)\nrepeat (80)\n    change [pixelate v] effect by (-10)\nend\nwait (2) seconds\nhide\nplay note (60) for (5) beats\n\n@MouseDown\n\nwhen flag clicked\nhide\nforever\n    set [ghost v] effect to (45)\n    if <mouse down?> then\n        show\n        go to (mouse-pointer v)\n    else\n        hide\n    end\nend\n\n@Water\n\nwhen I receive [enemydie v]\nset [yv v] to [-12]\n\nwhen flag clicked\nhide\n\nwhen I receive [ouchonleft v]\nset [ouch? v] to [true]\nrepeat (10)\n    change [xv v] by (-2.5)\nend\nwait (0.3) seconds\nset [ouch? v] to [false]\n\nwhen I receive [ouchonright v]\nset [ouch? v] to [true]\nrepeat (10)\n    change [xv v] by (2.5)\nend\nwait (0.3) seconds\nset [ouch? v] to [false]\n\nwhen I receive [newlevel v]\nrepeat (1)\n    delete this clone\nend\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nswitch costume to (superzoom v)\nset size to (1700) %\nshow\nforever\n    go to (groundhitbox v)\n    switch costume to ([costume # v] of [groundhitbox v])\n    set [ghost v] effect to (30)\n    go to [front v] layer\n    go [backward v] (4) layers\nend\n\n@Lives\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    go to [front v] layer\nend\n\nwhen flag clicked\nshow\nforever\n    if <(costume [number v]) = [10]> then\n        broadcast (NewLevel v)\n        switch costume to (9/9 v)\n    end\nend\n\nwhen I receive [ouchonleft v]\nnext costume\n\nwhen I receive [ouchonright v]\nnext costume\n\nwhen I receive [fall v]\nswitch costume to (0/9 v)\n\nwhen I receive [startgame v]\nswitch costume to (9/9 v)\n\nwhen I receive [newlevel v]\nswitch costume to (9/9 v)\n\nwhen I receive [ouchonleft v]\nnext costume\n\nwhen I receive [end v]\nhide\n\n@Messages/Cave\n\nwhen flag clicked\nhide\nwait (1) seconds\nwait until <(Game_Level) = [2]>\nwait (2) seconds\nforever\n    clear graphic effects\n    show\n    go to (hitbox v)\n    switch costume to (superzoom v)\n    set size to (1200) %\n    switch costume to (cavelevel v)\n    set [ghost v] effect to (6)\n    if <not <(Game_Level) = [2]>> then\n        clear graphic effects\n        switch costume to (level complete v)\n        set size to (100) %\n        go to x: (0) y: (0)\n        wait (0.1) seconds\n        go to x: (0) y: (0)\n        clear graphic effects\n        switch costume to (level complete v)\n        set size to (100) %\n        stop [this script v]\n    end\nend\n\nwhen I receive [nextlevel v]\nshow\nset size to (100) %\nswitch costume to (level complete v)\nclear graphic effects\ngo to x: (0) y: (0)\nswitch costume to (level complete v)\nset size to (100) %\ngo to x: (0) y: (0)\nstart sound [Dance Around v]\nwait (1) seconds\ngo to x: (0) y: (0)\nswitch costume to (level complete v)\nset size to (100) %\nrepeat (10)\n    go to x: (0) y: (0)\n    change [pixelate v] effect by (20)\n    change [ghost v] effect by (5)\n    switch costume to (level complete v)\n    set size to (100) %\nend\nrepeat (10)\n    go to x: (0) y: (0)\n    change [pixelate v] effect by (20)\n    change [ghost v] effect by (5)\n    switch costume to (level complete v)\n    set size to (100) %\nend\nhide\nif <(Game_Level) = [4]> then\n    broadcast (End v)\n    switch costume to (end v)\n    show\n    clear graphic effects\n    stop [all v]\nend\n\nwhen flag clicked\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.1)\nswitch costume to (thumbnail v)\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\nset size to (100) %\n\n@Fireball\n\nwhen I start as a clone\nforever\n    next costume\n    wait (0.01) seconds\nend\n\nwhen flag clicked\nforever\n    hide\n    if <<<<mouse down?> and <(distance to [mouse-pointer v]) < [80]>> or <key (space v) pressed?>> and <(PowerUp) = [2]>> then\n        create clone of (_myself_ v)\n        wait (0.1) seconds\n    end\nend\n\nwhen I start as a clone\ngo to (hitbox v)\nif <([direction v] of [hitbox v]) > [0]> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\nchange y by (25)\nmove (30) steps\nshow\nrepeat until <touching (_edge_ v)?>\n    move (30) steps\nend\ndelete this clone\n\n@Spikes\n\nwhen I receive [startgame v]\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\nforever\n    go to (groundhitbox v)\n    switch costume to ([costume # v] of [groundhitbox v])\nend\n\nwhen I start as a clone\nforever\n    if <touching (hitbox v)?> then\n        if <([direction v] of [hitbox v]) > [0]> then\n            broadcast (OuchOnRight v)\n            wait (2) seconds\n        else\n            broadcast (OuchOnLeft v)\n            wait (2) seconds\n        end\n    end\nend\n\n