A Little Witch - A Platformer v3.0
@Stage\n\nwhen [r v] key pressed\nif <([player can move? v] of [player v]) = [true]> then\n    broadcast (levelStartSwitch v)\nend\n\nwhen flag clicked\nswitch backdrop to (intro backdrop v)\n\nwhen I receive [start game v]\nstop all sounds\nswitch backdrop to (game backdrop v)\nset volume to (100) %\nwait (1) seconds\nforever\n    play sound [Game Music v] until done\nend\n\nwhen I receive [stop all v]\nrepeat (160)\n    wait (0.2) seconds\n    change volume by (-0.625)\nend\n\nwhen [o v] key pressed\nif <<([player can move? v] of [player v]) = [true]> and <not <(Game_Level) = [1]>>> then\n    change [game_level v] by (-1)\n    broadcast (levelStartSwitch v)\nend\n\nwhen [p v] key pressed\nif <<<([player can move? v] of [player v]) = [true]> and <not <(Game_Level) = [21]>>> and <<not <(Game_Level) = [15]>> or <not <(Game_Level) = [9]>>>> then\n    change [game_level v] by (1)\n    broadcast (levelStartSwitch v)\nend\n\nwhen I receive [start game v]\nif <(username) = [chipm0nk]> then\nend\n\nadd [Slowing Spell] to [spells v]\nadd [Stoning Spell] to [spells v]\n\n@Player\n\nwhen I receive [levelstartswitch v]\nset [xv v] to [0]\nset [yv v] to [0]\npoint in direction (90)\nif <(Game_Level) = [1]> then\n    go to x: (-216) y: (-61)\nend\nif <(Game_Level) = [2]> then\n    go to x: (-216) y: (-102)\nend\nif <(Game_Level) = [3]> then\n    go to x: (-216) y: (-102)\nend\nif <(Game_Level) = [4]> then\n    go to x: (-216) y: (-102)\nend\nif <(Game_Level) = [5]> then\n    go to x: (-216) y: (-102)\nend\nif <(Game_Level) = [6]> then\n    go to x: (-216) y: (-65)\nend\nif <(Game_Level) = [7]> then\n    go to x: (-216) y: (-78)\nend\nif <(Game_Level) = [8]> then\n    go to x: (-216) y: (-20)\nend\nif <(Game_Level) = [9]> then\n    go to x: (-216) y: (-40)\nend\nif <(Game_Level) = [10]> then\n    go to x: (-216) y: (-102)\nend\nif <(Game_Level) = [11]> then\n    go to x: (-216) y: (-102)\nend\nif <(Game_Level) = [12]> then\n    go to x: (-216) y: (-102)\nend\nif <(Game_Level) = [13]> then\n    go to x: (-216) y: (-102)\nend\nif <(Game_Level) = [14]> then\n    go to x: (-216) y: (82)\nend\nif <(Game_Level) = [15]> then\n    go to x: (-216) y: (97)\nend\nif <(Game_Level) = [16]> then\n    go to x: (-216) y: (-152)\nend\nif <(Game_Level) = [17]> then\n    go to x: (-216) y: (-33)\nend\nif <(Game_Level) = [18]> then\n    go to x: (-216) y: (-33)\nend\nif <(Game_Level) = [19]> then\n    go to x: (-216) y: (-154)\nend\nif <(Game_Level) = [20]> then\n    go to x: (-216) y: (138)\nend\nif <(Game_Level) = [21]> then\n    go to x: (-216) y: (-141)\nend\nif <(Game_Level) = [22]> then\n    point in direction (-90)\n    go to x: (30) y: (67)\nend\nif <(Game_Level) = [23]> then\n    go to x: (-216) y: (-118)\nend\nif <(Game_Level) = [24]> then\n    go to x: (-216) y: (-118)\nend\nif <(Game_Level) = [25]> then\n    go to x: (-216) y: (-118)\nend\nif <(Game_Level) = [26]> then\n    go to x: (-216) y: (90)\nend\nif <(Game_Level) = [27]> then\n    go to x: (-216) y: (62)\nend\nif <(Game_Level) = [28]> then\n    go to x: (-216) y: (62)\nend\n\nwhen I receive [player, stop! v]\nset [player can move? v] to [false]\n\nwhen I receive [player, go! v]\nset [player can move? v] to [true]\n\nwhen I receive [start game v]\nshow\nset [player can move? v] to [true]\nset [deaths? v] to [0]\nforever\n    if <(Player can move?) = [true]> then\n        go to [front v] layer\n        if <(In Water?) = [false]> then\n            go [backward v] (0) layers\n        else\n            go [backward v] (20) layers\n        end\n        set size to (205) %\n        set rotation style [don't rotate v]\n        switch costume to (hitbox v)\n        set [ghost v] effect to (0)\n        if <(y position) < [-195]> then\n            start sound [Player Death v]\n            broadcast (levelStartSwitch v)\n            change [deaths? 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) + (10))>> and <not <(mouse y) < ((y position) - (10))>>>> then\n            point in direction (90)\n            if <<(In Water?) = [false]> and <not <touching (broomstick v)?>>> then\n                change [xv v] by (2.8)\n            else\n                if <touching (broomstick v)?> then\n                    change [xv v] by (0.4)\n                else\n                    change [xv v] by (1.5)\n                end\n            end\n        end\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<<mouse down?> and <(mouse x) < ((x position) - (10))>> and <not <(mouse y) < ((y position) - (10))>>>> then\n            point in direction (-90)\n            if <<(In Water?) = [false]> and <not <touching (broomstick v)?>>> then\n                change [xv v] by (-2.8)\n            else\n                if <touching (broomstick v)?> then\n                    change [xv v] by (-0.4)\n                else\n                    change [xv v] by (-1.5)\n                end\n            end\n        end\n        if <touching (broomstick v)?> then\n            set [xv v] to ((XV) * (0.94))\n        else\n            set [xv v] to ((XV) * (0.5))\n        end\n        change x by (XV)\n        if <<touching (level v)?> or <touching (extra platforms v)?>> then\n            change y by (1)\n            if <<touching (level v)?> or <touching (extra platforms v)?>> then\n                change y by (1)\n                if <<touching (level v)?> or <touching (extra platforms v)?>> then\n                    change y by (1)\n                    if <<touching (level v)?> or <touching (extra platforms v)?>> then\n                        change y by (1)\n                        if <<touching (level v)?> or <touching (extra platforms v)?>> then\n                            change y by (1)\n                            if <<touching (level v)?> or <touching (extra platforms 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 <touching (broomstick v)?> then\n            set [yv v] to ((YV) * (0.8))\n        end\n        if <touching (lava v)?> then\n            broadcast (levelStartSwitch v)\n            change [deaths? v] by (1)\n        end\n        if <<(In Water?) = [false]> and <not <touching (broomstick v)?>>> then\n            change [yv v] by (-1)\n        else\n            if <not <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (40))>>>> then\n                change [yv v] by (-0.4)\n            end\n        end\n        if <<<<(In Water?) = [true]> or <touching (broomstick v)?>> and <<key (down arrow v) pressed?> or <<mouse down?> and <(mouse y) < ((x position) - (10))>>>> and <not <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > ((y position) + (40))>>>>>> then\n            if <touching (broomstick v)?> then\n                change [yv v] by (-0.7)\n            else\n                set [yv v] to [-4]\n            end\n        end\n        change y by (YV)\n        change [in air? v] by (1)\n        if <<touching (level v)?> or <touching (extra platforms v)?>> then\n            change y by ((YV) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <<touching (level v)?> or <touching (extra platforms v)?>> then\n            set [in air? v] to [0]\n        end\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > ((y position) + (40))>>> then\n            if <<(In Water?) = [true]> or <touching (broomstick v)?>> then\n                if <touching (broomstick v)?> then\n                    change [yv v] by (0.6)\n                else\n                    set [yv v] to [4]\n                end\n            end\n            if <(In Air?) < [3]> then\n                if <(In Water?) = [false]> then\n                    set [yv v] to [10]\n                end\n            end\n        end\n        change y by (1)\n        set rotation style [left-right v]\n        Set Correct Costume\n        if <(Casting a Spell?) = [false]> then\n            if <key (space v) pressed?> then\n                set [casting a spell? v] to [true]\n            end\n        end\n    end\n    if <touching (water v)?> then\n        set [in water? v] to [true]\n    else\n        set [in water? v] to [false]\n    end\nend\n\nwhen I receive [start game v]\nset [casting a spell? v] to [false]\nforever\n    if <<(x position) > [225]> or <touching (portal v)?>> then\n        change [game_level v] by (1)\n        wait (0.01) seconds\n        broadcast (levelStartSwitch v)\n    end\nend\n\nwhen I receive [start game v]\nforever\n    if <(Player can move?) = [true]> then\n        if <(Casting a Spell?) = [true]> then\n            set [casting a spell? v] to [Wand = Up]\n            broadcast (Spell Cast v)\n            wait (0.1) seconds\n            set [casting a spell? v] to [Wand = Down]\n            wait (0.3) seconds\n            set [casting a spell? v] to [false]\n        end\n    end\nend\n\nwhen I receive [start game v]\nforever\n    if <(Player can move?) = [true]> then\n        set [walk animation v] to [1]\n        wait (0.1) seconds\n        set [walk animation v] to [2]\n        wait (0.1) seconds\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [player death v]\nswitch costume to (hitbox v)\nif <touching (enemy v)?> then\n    broadcast (levelStartSwitch v)\n    Set Correct Costume\n    start sound [Player Death v]\n    change [deaths? v] by (1)\nelse\n    Set Correct Costume\nend\n\ndefine Set Correct Costume\nif <(Player can move?) = [true]> then\n    if <not <(Casting a Spell?) = [true]>> then\n        if <(In Air?) = [0]> then\n            if <([abs v] of (XV) ) < [1]> then\n                switch costume to (stand v)\n            else\n                switch costume to (Walk Animation)\n            end\n        else\n            switch costume to (walk/jump v)\n        end\n        if <touching (broomstick v)?> then\n            switch costume to (broom riding v)\n        end\n        if <[Wand = Up] = (Casting a Spell?)> then\n            if <([abs v] of (XV) ) > [1]> then\n                switch costume to ((Walk Animation) + (2))\n            else\n                switch costume to (casting spell1 v)\n            end\n            if <touching (broomstick v)?> then\n                switch costume to (broom riding casting spell v)\n            end\n        end\n        if <[Wand = Down] = (Casting a Spell?)> then\n            if <([abs v] of (XV) ) > [0.7]> then\n                switch costume to ((Walk Animation) + (4))\n            else\n                switch costume to (casting spell2 v)\n            end\n            if <touching (broomstick v)?> then\n                switch costume to (broom riding casting spell2 v)\n            end\n        end\n    end\nend\n\nwhen I receive [stop all v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [player, cast a spell! v]\nif <(Casting a Spell?) = [false]> then\n    set [casting a spell? v] to [true]\nend\n\n@Level\n\nwhen I receive [levelstartswitch v]\nswitch costume to (Game_Level)\n\nwhen I receive [start game v]\nshow\nforever\n    show\n    go to [front v] layer\n    go [backward v] (3) layers\n    if <<(Game_Level) = [22]> and <not <(username) = [chipm0nk]>>> then\n        hide\n    end\n    switch costume to (Game_Level)\nend\n\nwhen I receive [start game v]\nset [game_level v] to [1]\nbroadcast (levelStartSwitch v)\n\nif <(username) = [chipm0nk]> then\n    set [game_level v] to [28]\n    broadcast (levelStartSwitch v)\nelse\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [stop all v]\nhide\nstop [other scripts in sprite v]\n\n@Enemy\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\npoint towards (player v)\nset [blob speed v] to [1]\nset [petrified? v] to [false]\nif <(Enemy Type) = [1]> then\n    set size to (235) %\nend\nforever\n    if <([player can move? v] of [player v]) = [true]> then\n        if <(Enemy Type) = [1]> then\n            set rotation style [don't rotate v]\n            switch costume to (green blob - hitbox v)\n            set [ghost v] effect to (0)\n            if <(y position) < [-180]> then\n                set [yv v] to [0]\n                delete this clone\n            end\n            if <<(distance to [player v]) < [110]> and <(Petrified?) = [false]>> then\n                if <([x position v] of [player v]) > ((x position) + (2))> then\n                    point in direction (90)\n                    change [xv v] by (Blob Speed)\n                end\n                if <([x position v] of [player v]) < ((x position) - (2))> then\n                    point in direction (-90)\n                    change [xv v] by ((-1) * (Blob Speed))\n                end\n            end\n            set [xv v] to ((XV) * (0.5))\n            change x by (XV)\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 x by ((XV) * (-1))\n                                    change y by (-5)\n                                    set [xv v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n            change [yv v] by (-1)\n            change y by (YV)\n            change [in air? v] by (1)\n            if <touching (level v)?> then\n                change y by ((YV) * (-1))\n                set [yv v] to [0]\n            end\n            change y by (-1)\n            if <touching (level v)?> then\n                set [in air? v] to [0]\n            end\n            if <<touching (player v)?> and <(Petrified?) = [false]>> then\n                broadcast (Player Death v)\n            end\n            if <(Petrified?) = [false]> then\n                if <(In Air?) = [0]> then\n                    if <([abs v] of (XV) ) < [0.25]> then\n                        switch costume to (green blob - stand v)\n                    else\n                        switch costume to (Blob Walk animation)\n                    end\n                else\n                    switch costume to (green blob - crawl v)\n                end\n            else\n                switch costume to (stone blob  v)\n            end\n            change y by (1)\n            set rotation style [left-right v]\n        end\n    end\nend\n\nwhen I receive [levelstartswitch v]\nrepeat (1)\n    delete this clone\nend\nif <(Game_Level) = [1]> then\n    hide\nend\nif <(Game_Level) = [2]> then\n    hide\nend\nif <(Game_Level) = [3]> then\n    hide\nend\nif <(Game_Level) = [4]> then\n    Green Blob at X [-66] Y [-101]\nend\nif <(Game_Level) = [5]> then\n    hide\nend\nif <(Game_Level) = [6]> then\n    Green Blob at X [-93] Y [-69]\n    Green Blob at X [0] Y [-33]\n    Green Blob at X [73] Y [-13]\nend\nif <(Game_Level) = [7]> then\n    Green Blob at X [-35] Y [117]\nend\nif <(Game_Level) = [8]> then\n    hide\nend\nif <(Game_Level) = [9]> then\n    hide\nend\nif <(Game_Level) = [10]> then\n    Green Blob at X [30] Y [-100]\n    Green Blob at X [120] Y [-100]\n    Green Blob at X [-60] Y [-100]\nend\nif <(Game_Level) = [11]> then\n    Green Blob at X [30] Y [84]\n    Green Blob at X [145] Y [84]\nend\nif <(Game_Level) = [12]> then\n    Ghost at X [-25] Y [0]\n    Ghost at X [170] Y [-20]\nend\nif <(Game_Level) = [13]> then\n    Green Blob at X [-46] Y [77]\n    Ghost at X [160] Y [15]\nend\nif <(Game_Level) = [14]> then\n    Ghost at X [100] Y [-120]\n    Ghost at X [-105] Y [-110]\n    Green Blob at X [20] Y [-143]\n    Green Blob at X [-43] Y [-10]\nend\nif <(Game_Level) = [14]> then\n    hide\nend\nif <(Game_Level) = [16]> then\n    Flaming Pumpkin at X [77] Y [-33]\n    Flaming Pumpkin at X [-79] Y [-33]\n    Flaming Pumpkin at X [107] Y [-152]\n    Flaming Pumpkin at X [-109] Y [-152]\nend\nif <(Game_Level) = [17]> then\n    Flaming Pumpkin at X [-102] Y [-32]\n    Flaming Pumpkin at X [2] Y [-32]\n    Flaming Pumpkin at X [109] Y [-32]\nend\nif <(Game_Level) = [18]> then\n    Ghost at X [200] Y [-125]\n    Flaming Pumpkin at X [-60] Y [-130]\n    Flaming Pumpkin at X [120] Y [-130]\nend\nif <(Game_Level) = [19]> then\n    Flaming Pumpkin at X [190] Y [-100]\n    Flaming Pumpkin at X [190] Y [32]\n    Flaming Pumpkin at X [-220] Y [-31]\n    Green Blob at X [60] Y [-100]\n    Green Blob at X [-60] Y [-100]\n    Green Blob at X [0] Y [-31]\n    Green Blob at X [60] Y [32]\n    Green Blob at X [-60] Y [32]\nend\nif <(Game_Level) = [20]> then\n    Green Blob at X [71] Y [-9]\n    Green Blob at X [25] Y [60]\n    Flaming Pumpkin at X [194] Y [-141]\n    Ghost at X [155] Y [120]\nend\nif <(Game_Level) = [21]> then\n    hide\nend\nif <(Game_Level) = [22]> then\n    Green Blob at X [100] Y [-117]\n    Green Blob at X [50] Y [-117]\n    Green Blob at X [150] Y [-117]\n    Flaming Pumpkin at X [-150] Y [-36]\nend\nif <(Game_Level) = [23]> then\n    Flaming Pumpkin at X [-23] Y [-60]\nend\nif <(Game_Level) = [24]> then\n    Fish at X [100] Y [-100]\n    Fish at X [-30] Y [100]\nend\nif <(Game_Level) = [25]> then\n    Fish at X [100] Y [-100]\n    Fish at X [-30] Y [0]\nend\nif <(Game_Level) = [26]> then\n    Ghost at X [85] Y [110]\n    Flaming Pumpkin at X [70] Y [88]\n    Fish at X [105] Y [-15]\n    Fish at X [35] Y [-120]\nend\n\ndefine Green Blob at X (x) Y (y)\nset [enemy type v] to [1]\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nhide\n\nwhen I receive [reset speed in 5 seconds v]\nif <<(Blob Speed) > [1]> or <(Ghost Speed) > [2]>> then\n    wait (5) seconds\n    set [blob speed v] to [1]\n    set [ghost speed v] to [2]\nend\n\nwhen I start as a clone\nforever\n    if <(Enemy Type) = [2]> then\n        set [ghost animation v] to [4]\n        wait (0.2) seconds\n        set [ghost animation v] to [5]\n        wait (0.2) seconds\n        set [ghost animation v] to [6]\n        wait (0.2) seconds\n        set [ghost animation v] to [5]\n        wait (0.2) seconds\n    end\nend\n\ndefine Ghost at X (x) Y (y)\nset [enemy type v] to [2]\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nforever\n    if <touching color (#cdff48)?> then\n        repeat (6)\n            change size by (12.5)\n        end\n        wait (0.1) seconds\n    end\nend\n\nwhen I start as a clone\nforever\n    set [blob walk animation v] to [1]\n    wait (0.06) seconds\n    set [blob walk animation v] to [2]\n    wait (0.06) seconds\nend\n\nwhen I start as a clone\nshow\npoint towards (player v)\nset [ghost speed v] to [2]\nif <(Enemy Type) = [2]> then\n    set size to (150) %\nend\nforever\n    go to [front v] layer\n    if <([player can move? v] of [player v]) = [true]> then\n        if <(Enemy Type) = [2]> then\n            if <(Petrified?) = [false]> then\n                set rotation style [don't rotate v]\n                switch costume to (ghost - hitbox v)\n                set [ghost v] effect to (45)\n                if <([x position v] of [player v]) > ((x position) + (2))> then\n                    point in direction (90)\n                    change [xv v] by (Ghost Speed)\n                end\n                if <([x position v] of [player v]) < ((x position) - (2))> then\n                    point in direction (-90)\n                    change [xv v] by ((-1) * (Ghost Speed))\n                end\n                if <([y position v] of [player v]) > ((y position) + (2))> then\n                    set [yv v] to ((0.4) * (Ghost Speed))\n                end\n                if <([y position v] of [player v]) < ((y position) - (2))> then\n                    set [yv v] to ((-1) * (Ghost Speed))\n                end\n                set [xv v] to ((XV) * (0.5))\n                change x by (XV)\n                if <<touching (level v)?> or <touching (enemy v)?>> then\n                    change y by (1)\n                    if <<touching (level v)?> or <touching (enemy v)?>> then\n                        change y by (1)\n                        if <<touching (level v)?> or <touching (enemy v)?>> then\n                            change y by (1)\n                            if <<touching (level v)?> or <touching (enemy v)?>> then\n                                change y by (1)\n                                if <<touching (level v)?> or <touching (enemy v)?>> then\n                                    change y by (1)\n                                    if <<touching (level v)?> or <touching (enemy v)?>> then\n                                        change x by ((XV) * (-1))\n                                        change y by (-5)\n                                        set [xv v] to [0]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n                change y by (YV)\n                change [in air? v] by (1)\n                if <touching (level v)?> then\n                    change y by ((YV) * (-1))\n                    set [yv v] to [0]\n                end\n                change y by (-1)\n                if <<touching (level v)?> or <touching (enemy v)?>> then\n                    set [in air? v] to [0]\n                end\n                if <<touching (player v)?> and <(Petrified?) = [false]>> then\n                    broadcast (Player Death v)\n                end\n                change y by (1)\n                switch costume to (Ghost Animation)\n                set rotation style [left-right v]\n            end\n            if <(Petrified?) = [true]> then\n                switch costume to (stone ghost v)\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nshow\nif <(Enemy Type) = [3]> then\n    set size to (205) %\nend\nforever\n    if <([player can move? v] of [player v]) = [true]> then\n        if <(Enemy Type) = [3]> then\n            if <(Petrified?) = [false]> then\n                if <(Petrified?) = [false]> then\n                    switch costume to (pumpkin1 v)\n                end\n                wait (1) seconds\n                if <(Petrified?) = [false]> then\n                    switch costume to (pumpkin2 v)\n                end\n                wait (0.1) seconds\n                if <(Petrified?) = [false]> then\n                    repeat (5)\n                        if <(Petrified?) = [false]> then\n                            Belching Fire at X (x position) Y (y position)\n                            set [enemy type v] to [3]\n                        end\n                        show\n                        wait (0.2) seconds\n                    end\n                    wait (0.3) seconds\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nshow\nif <(Enemy Type) = [4]> then\n    set size to (205) %\n    switch costume to (pumpkin fire v)\n    repeat until <<touching (_edge_ v)?> or <touching (level v)?>>\n        change y by (3)\n        change size by (2)\n        if <touching (player v)?> then\n            broadcast (Player Death v)\n        end\n    end\n    repeat (3)\n        change y by (3)\n        change size by (2)\n    end\n    delete this clone\nend\n\ndefine Flaming Pumpkin at X (x) Y (y)\nset [enemy type v] to [3]\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nhide\n\ndefine Belching Fire at X (x) Y (y)\nset [enemy type v] to [4]\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nforever\n    if <(Enemy Type) = [3]> then\n        if <(Petrified?) = [true]> then\n            switch costume to (stone pumpkin v)\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    if <touching color (#d3acde)?> then\n        broadcast (turned to Stone v)\n        set [petrified? v] to [true]\n        set [time petrified? v] to [0]\n    end\nend\n\nwhen I start as a clone\nforever\n    if <touching color (#60f4ff)?> then\n        set [blob speed v] to [0.3]\n        set [ghost speed v] to [0.7]\n        set [fish speed? v] to [0.5]\n        wait (5) seconds\n        set [fish speed? v] to [1.2]\n        set [blob speed v] to [1]\n        set [ghost speed v] to [2]\n    end\n    if <touching (lava v)?> then\n        delete this clone\n    end\nend\n\nwhen I receive [turned to stone v]\nwait ((6) - (Time petrified?)) seconds\nif <(Time petrified?) > [5.9]> then\n    set [petrified? v] to [false]\nend\n\nwhen I start as a clone\nforever\n    set [time petrified? v] to [0]\n    if <(Petrified?) = [true]> then\n        repeat until <(Petrified?) = [false]>\n            change [time petrified? v] by (0.1)\n        end\n    end\nend\n\nwhen I receive [stop all v]\nstop [other scripts in sprite v]\n\nwhen I start as a clone\nshow\nforever\n    if <(Enemy Type) = [5]> then\n        go to [front v] layer\n        go [backward v] (21) layers\n        if <(Petrified?) = [false]> then\n            go to [front v] layer\n            go [backward v] (21) layers\n            set size to (205) %\n            set rotation style [don't rotate v]\n            switch costume to (fish hitbox v)\n            set [ghost v] effect to (0)\n            set [xv v] to ((XV) * (0.5))\n            change x by (XV)\n            if <<touching (level v)?> or <touching (extra platforms v)?>> then\n                change y by (1)\n                if <<touching (level v)?> or <touching (extra platforms v)?>> then\n                    change y by (1)\n                    if <<touching (level v)?> or <touching (extra platforms v)?>> then\n                        change y by (1)\n                        if <<touching (level v)?> or <touching (extra platforms v)?>> then\n                            change y by (1)\n                            if <<touching (level v)?> or <touching (extra platforms v)?>> then\n                                change y by (1)\n                                if <<touching (level v)?> or <touching (extra platforms 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 <(In Water?) = [false]> then\n                change [yv v] by ((-1) * (((Fish Speed?) / (3)) * (2)))\n            else\n                change [yv v] by ((-0.1) * (((Fish Speed?) / (3)) * (2)))\n            end\n            change y by (YV)\n            change [in air? v] by (1)\n            if <<touching (level v)?> or <touching (extra platforms v)?>> then\n                change y by ((YV) * (-1))\n                set [yv v] to [0]\n            end\n            change y by (-1)\n            if <<touching (level v)?> or <touching (extra platforms v)?>> then\n                set [in air? v] to [0]\n            end\n            change y by (1)\n            set rotation style [left-right v]\n            if <touching (player v)?> then\n                broadcast (Player Death v)\n            end\n            if <touching (water v)?> then\n                set [in water? v] to [true]\n            else\n                set [in water? v] to [false]\n            end\n            if <(distance to [player v]) < [120]> then\n                switch costume to (fish2 v)\n            else\n                switch costume to (fish v)\n            end\n        end\n        if <(Petrified?) = [true]> then\n            switch costume to (stone fish v)\n        end\n    end\nend\n\ndefine Fish at X (x) Y (y)\nset [enemy type v] to [5]\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nset [fish speed? v] to [1.2]\nforever\n    if <(Enemy Type) = [5]> then\n        if <(Petrified?) = [false]> then\n            if <(distance to [player v]) < [120]> then\n                if <([y position v] of [player v]) > (y position)> then\n                    if <([x position v] of [player v]) > (x position)> then\n                        set [fish movement type? v] to [7]\n                    else\n                        set [fish movement type? v] to [5]\n                    end\n                else\n                    if <([x position v] of [player v]) > (x position)> then\n                        set [fish movement type? v] to [8]\n                    else\n                        set [fish movement type? v] to [6]\n                    end\n                end\n            else\n                set [fish movement type? v] to (pick random (1) to (8))\n            end\n            if <(Fish Movement Type?) = [1]> then\n                point in direction (90)\n                repeat (8)\n                    change [xv v] by (Fish Speed?)\n                end\n            end\n            if <(Fish Movement Type?) = [2]> then\n                point in direction (-90)\n                repeat (8)\n                    change [xv v] by ((-1) * (Fish Speed?))\n                end\n            end\n            if <(Fish Movement Type?) = [3]> then\n                point in direction (-90)\n                repeat (8)\n                    set [yv v] to (((Fish Speed?) / (3)) * (2))\n                end\n            end\n            if <(Fish Movement Type?) = [4]> then\n            if <(Fish Movement Type?) = [5]> then\n                point in direction (-90)\n                repeat (8)\n                    change [xv v] by ((-1) * (Fish Speed?))\n                    set [yv v] to (((Fish Speed?) / (3)) * (2))\n                end\n            end\n            if <(Fish Movement Type?) = [6]> then\n                point in direction (-90)\n                repeat (8)\n                    change [xv v] by ((-1) * (Fish Speed?))\n                end\n            end\n            if <(Fish Movement Type?) = [7]> then\n                point in direction (90)\n                repeat (8)\n                    change [xv v] by (Fish Speed?)\n                    set [yv v] to (((Fish Speed?) / (3)) * (2))\n                end\n            end\n            if <(Fish Movement Type?) = [8]> then\n                point in direction (90)\n                repeat (8)\n                    change [xv v] by (Fish Speed?)\n                end\n            end\n        end\n    end\nend\n\n@Water\n\nwhen I receive [start game v]\nshow\nforever\n    go to (level v)\n    set [ghost v] effect to (55)\n    if <([player can move? v] of [player v]) = [true]> then\n        repeat (40)\n            if <([player can move? v] of [player v]) = [true]> then\n                change y by (0.1)\n            end\n        end\n        repeat (40)\n            if <([player can move? v] of [player v]) = [true]> then\n                change y by (-0.1)\n            end\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nforever\n    switch costume to ([costume # v] of [level v])\nend\n\n@Lava\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ndelete this clone\n\nwhen I receive [start game v]\nforever\n    show\n    switch costume to ([costume # v] of [level v])\n    go to [front v] layer\n    go [backward v] (5) layers\nend\n\nwhen I receive [start game v]\nforever\n    go to (level v)\n    if <([player can move? v] of [player v]) = [true]> then\n        repeat (40)\n            if <([player can move? v] of [player v]) = [true]> then\n                change y by (0.2)\n            end\n        end\n        repeat (40)\n            if <([player can move? v] of [player v]) = [true]> then\n                change y by (-0.2)\n            end\n        end\n    end\nend\n\nwhen I receive [stop all v]\nstop [other scripts in sprite v]\n\n@Extra Platforms\n\nwhen I receive [levelstartswitch v]\nwait (0.1) seconds\nshow\nclear graphic effects\nif <(Game_Level) = [9]> then\n    wait (0.1) seconds\n    wait until <[spells v] contains [Slowing Spell]?>\n    wait (0.1) seconds\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\n    hide\nend\nif <(Game_Level) = [15]> then\n    wait (0.1) seconds\n    wait until <[spells v] contains [Stoning Spell]?>\n    wait (0.1) seconds\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\n    hide\nend\n\nwhen I receive [start game v]\nforever\n    go to (level v)\n    switch costume to ([costume name v] of [level v])\n    go to [back v] layer\n    if <(Game_Level) = [15]> then\n        go to [front v] layer\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [stop all v]\nstop [other scripts in sprite v]\n\n@Magic\n\nwhen flag clicked\nhide\n\nwhen I receive [spell cast v]\nif <not <(Spell Type?) = [0]>> then\n    if <(distance to [player v]) < [16]> then\n        if <<[spells v] contains [Slowing Spell]?> and <(Spell Type?) = [1]>> then\n            wait (0.1) seconds\n            create clone of (_myself_ v)\n        end\n        if <<[spells v] contains [Stoning Spell]?> and <(Spell Type?) = [2]>> then\n            wait (0.1) seconds\n            create clone of (_myself_ v)\n        end\n    end\nend\n\nwhen I start as a clone\nstart sound [Magic Spell v]\nshow\nif <(Spell Type?) = [1]> then\n    switch costume to (slowing spell v)\nend\nif <(Spell Type?) = [2]> then\n    switch costume to (petrifying spell v)\nend\nset size to (90) %\nrepeat (2)\n    move (4) steps\nend\nrepeat until <<touching (_edge_ v)?> or <touching (level v)?>>\n    change y by (-5)\n    if <touching (enemy v)?> then\n        set size to (10) %\n        next costume\n        move (20) steps\n        change y by (20)\n        change size by (10)\n        wait (0.03) seconds\n        repeat (4)\n            change size by (10)\n            change [ghost v] effect by (25)\n        end\n        wait (0.1) seconds\n        delete this clone\n    end\n    change y by (5)\n    move (7) steps\nend\nif <touching (_edge_ v)?> then\n    delete this clone\nend\nset size to (10) %\nnext costume\nmove (20) steps\nchange y by (20)\nchange size by (10)\nwait (0.03) seconds\nrepeat (4)\n    change size by (10)\n    change [ghost v] effect by (25)\nend\nwait (0.1) seconds\ndelete this clone\n\nwhen I receive [levelstartswitch v]\nrepeat (1)\n    delete this clone\nend\n\nwhen I start as a clone\nforever\n    go to [front v] layer\nend\n\nwhen I receive [start game v]\nforever\n    set rotation style [left-right v]\n    go to (player v)\n    point in direction ([direction v] of [player v])\n    set [spell type? v] to ([spell selected? v] of [spells v])\n    hide\nend\n\nwhen I receive [stop all v]\nstop [other scripts in sprite v]\n\n@Spells\n\nwhen I receive [levelstartswitch v]\nwait (0.1) seconds\nif <<(Game_Level) = [9]> and <(Display?) = [false]>> then\n    delete (item # of [Slowing Spell] in [spells v]) of [spells v]\n    show\n    go to x: (0) y: (-88)\n    switch costume to (slowing spell v)\n    wait (0.1) seconds\n    wait until <touching (player v)?>\n    set [spell selected? v] to [1]\n    broadcast (Player, Stop! v)\n    set size to (205) %\n    point in direction (90)\n    create clone of (_myself_ v)\nend\nif <<(Game_Level) = [15]> and <(Display?) = [false]>> then\n    delete (item # of [Stoning Spell] in [spells v]) of [spells v]\n    show\n    go to x: (0) y: (-45)\n    switch costume to (petrifying spell v)\n    wait (0.1) seconds\n    wait until <touching (player v)?>\n    set [spell selected? v] to [2]\n    broadcast (Player, Stop! v)\n    set size to (205) %\n    point in direction (90)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [levelstartswitch v]\nwait (0.1) seconds\nif <(Display?) = [false]> then\n    if <<(Game_Level) = [9]> or <(Game_Level) = [15]>> then\n        repeat until <touching (player v)?>\n            point in direction ((([sin v] of ((Bounce) + (-50)) ) * (5)) + (90))\n            set size to ((([sin v] of (Bounce) ) * (-10)) + (205)) %\n            change [bounce v] by (12)\n        end\n        set size to (205) %\n        point in direction (90)\n        play sound [Wand v] until done\n    end\nend\n\nwhen I start as a clone\nset [display? v] to [true]\ngo to x: (0) y: (-39)\nset size to (205) %\npoint in direction (90)\nif <(Game_Level) = [9]> then\n    set [spell selected? v] to [1]\n    switch costume to (slowing spell 2 v)\n    show\n    if <not <[spells v] contains [Slowing Spell]?>> then\n        add [Slowing Spell] to [spells v]\n    end\nend\nif <(Game_Level) = [15]> then\n    set [spell selected? v] to [2]\n    switch costume to (petrifying spell 2 v)\n    show\n    if <not <[spells v] contains [Stoning Spell]?>> then\n        add [Stoning Spell] to [spells v]\n    end\nend\nset size to (0) %\nrepeat (20)\n    change size by (10)\nend\nforever\n    go to [front v] layer\nend\n\nwhen [x v] key pressed\nif <(Display?) = [true]> then\n    hide\n    broadcast (Player, Go! v)\nend\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nif <<(x position) = [-220]> and <(y position) = [145]>> then\n    broadcast (Player, Stop! v)\n    go to x: (0) y: (-39)\n    set size to (205) %\n    point in direction (90)\n    if <(costume [number v]) = [1]> then\n        switch costume to (slowing spell 2 v)\n        set [spell selected? v] to [1]\n    end\n    if <(costume [number v]) = [2]> then\n        switch costume to (petrifying spell 2 v)\n        set [spell selected? v] to [2]\n    end\n    show\n    set size to (0) %\n    repeat (20)\n        change size by (10)\n    end\n    forever\n        go to [front v] layer\n    end\nend\n\nwhen [z v] key pressed\nchange [spell selected? v] by (1)\nif <(Spell Selected?) > (length of [spells v])> then\n    set [spell selected? v] to [1]\nend\nwait (0.2) seconds\n\nwhen I receive [levelstartswitch v]\nif <(Game_Level) = [15]> then\n    set [spell selected? v] to [1]\nend\n\nwhen I receive [player, go! v]\nhide\n\nwhen I receive [start game v]\nhide\ndelete all of [spells v]\nforever\n    set [display? v] to [false]\nend\n\nwhen I receive [levelstartswitch v]\nset [display? v] to [false]\n\nwhen I receive [stop all v]\nstop [other scripts in sprite v]\n\nwhen this sprite clicked\nif <(Display?) = [true]> then\n    hide\n    broadcast (Player, Go! v)\nend\ndelete this clone\n\nwhen this sprite clicked\nchange [spell selected? v] by (1)\nif <(Spell Selected?) > (length of [spells v])> then\n    set [spell selected? v] to [1]\nend\nwait (0.2) seconds\n\n@Spell Display\n\nwhen I receive [levelstartswitch v]\nif <(Game_Level) = [15]> then\n    switch costume to (slowing spell v)\nend\n\nwhen I receive [start game v]\nforever\n    show\n    set size to (400) %\n    switch costume to ([spell selected? v] of [spells v])\n    clear graphic effects\n    set [ghost v] effect to (50)\n    if <(length of [spells v]) = [0]> then\n        hide\n    end\n    go to [front v] layer\n    go [backward v] (2) layers\n    go to x: (-215) y: (139)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [stop all v]\nstop [other scripts in sprite v]\n\n@Intro\n\nwhen flag clicked\npoint in direction (90)\nbroadcast (Intro v)\nforever\n    go to [front v] layer\nend\n\nwhen I receive [start game v]\nhide\n\nwhen I receive [intro v]\nshow\nset [intro clone type v] to [1]\ncreate clone of (_myself_ v)\nswitch costume to (blocks v)\ngo to x: (0) y: (0)\nwait (1.1) seconds\nstart sound [Blocks crashing v]\nrepeat (4)\n    next costume\n    wait (0.06) seconds\nend\nwait (1) seconds\n\nwhen I start as a clone\nif <(Intro Clone Type) = [1]> then\n    hide\n    switch costume to (chipmunk jumping v)\n    go to x: (267) y: (210)\n    wait (0.8) seconds\n    show\n    glide (0.4) secs to x: (-10) y: (-20)\n    switch costume to (chipmunk landing v)\n    start sound [Landing v]\n    move (-10) steps\n    wait (0.02) seconds\n    move (-5) steps\n    wait (0.02) seconds\n    move (-2.5) steps\n    wait (0.2) seconds\n    set [intro clone type v] to [2]\n    create clone of (_myself_ v)\n    switch costume to (chipmunk landing 2 v)\n    wait (0.1) seconds\n    switch costume to (chipmunk landing 3 v)\nend\n\nwhen I start as a clone\nif <(Intro Clone Type) = [2]> then\n    go to x: (0) y: (0)\n    set [ghost v] effect to (100)\n    switch costume to (@chipm0nk v)\n    repeat (20)\n        change [ghost v] effect by (-5)\n    end\n    wait (0.8) seconds\n    broadcast (Intro Finished! v)\nend\n\nwhen I receive [intro finished! v]\nshow\npoint in direction (90)\ngo to x: (0) y: (0)\nswitch costume to (flash v)\nwait (0.14) seconds\nhide\nbroadcast (Story v)\nstart sound [Finish v]\ndelete this clone\n\nwhen I receive [stop all v]\nstop [other scripts in sprite v]\n\nwhen I receive [stop all v]\nstop [other scripts in sprite v]\n\nwhen I receive [story v]\nhide\n\nif <(username) = [chipm0nk]> then\nelse\n    broadcast (Start Game v)\nend\n\nif <(username) = [chipm0nk]> then\n    broadcast (Start Game v)\nelse\nend\n\n@Extra Graphics\n\n@Portal\n\nwhen flag clicked\nhide\n\nwhen I receive [stop all v]\nstop [other scripts in sprite v]\n\nwhen I receive [start game v]\nforever\n    set size to (250) %\n    go to x: (0) y: (-112)\n    point in direction ((([sin v] of ((bounce) + (-50)) ) * (5)) + (90))\n    set size to ((([sin v] of (bounce) ) * (-5)) + (205)) %\n    change [bounce v] by (8)\n    if <(Game_Level) = [21]> then\n        show\n    else\n        hide\n    end\nend\n\n@Thumbnail\n\nwhen I receive [levelstartswitch v]\nif <<(Game_Level) = [22]> and <not <(username) = [chipm0nk]>>> then\n    broadcast (Stop All v)\n    show\n    wait (1) seconds\n    repeat (80)\n        change [ghost v] effect by (-2.5)\n    end\nend\n\nwhen flag clicked\nset [ghost v] effect to (100)\nswitch costume to (thumbnail v2 v)\nforever\n    go to [front v] layer\n    reset timer\nend\n\nwhen [timer v] > (0.1)\nswitch costume to (thumbnail v2 v)\ngo to [front v] layer\n\n@Story\n\nwhen flag clicked\nhide\n\nwhen I receive [story v]\nshow\ngo to x: (-180) y: (-170)\ncreate clone of (_myself_ v)\ngo to x: (180) y: (-170)\ncreate clone of (_myself_ v)\ngo to x: (0) y: (0)\nswitch costume to (part 1 v)\nset [brightness v] effect to (100)\nwait (0.5) seconds\nrepeat (20)\n    change [brightness v] effect by (-5)\nend\nforever\n    if <<mouse down?> or <key (right arrow v) pressed?>> then\n        if <(costume [number v]) < [9]> then\n            start sound [pop v]\n            next costume\n            wait (0.1) seconds\n        else\n            broadcast (Start Game v)\n            repeat (10)\n                change [brightness v] effect by (10)\n                change [ghost v] effect by (10)\n            end\n            hide\n            stop [this script v]\n        end\n    end\n    if <key (left arrow v) pressed?> then\n        start sound [pop v]\n        switch costume to ((costume [number v]) - (1))\n        wait (0.1) seconds\n    end\nend\n\nwhen I start as a clone\nswitch costume to (blank v)\nset size to (1200) %\nshow\nforever\n    set [ghost v] effect to (20)\n    go to [front v] layer\n    switch costume to (flame 1 v)\n    repeat (4)\n        wait (0.05) seconds\n        next costume\n    end\n    wait (0.05) seconds\nend\n\nwhen I receive [start game v]\ndelete this clone\n\nwhen I receive [story v]\nset volume to (100) %\nforever\n    play sound [Wind sound v] until done\nend\n\nwhen I receive [start game v]\nrepeat (40)\n    change volume by (-2.5)\nend\n\n@Button\n\nwhen flag clicked\nhide\n\nwhen I receive [start game v]\nforever\n    hide\n    if <(length of [spells v]) > [0]> then\n        go to [front v] layer\n        show\n        set [brightness v] effect to (0)\n        if <touching (mouse-pointer v)?> then\n            set [brightness v] effect to (25)\n        end\n    end\nend\n\nwhen this sprite clicked\nif <([casting a spell? v] of [player v]) = [false]> then\n    broadcast (Player, cast a spell! v)\nend\n\n@Broomstick\n\nwhen I receive [levelstartswitch v]\nset rotation style [left-right v]\nhide\nif <(Game_Level) = [27]> then\n    show\n    go to x: (-170) y: (65)\n    Broomstick on Game Level [27]\nend\nif <(Game_Level) = [28]> then\n    show\n    go to x: (-143) y: (45)\n    Broomstick on Game Level [28]\nend\n\nwhen flag clicked\nhide\n\ndefine Broomstick on Game Level (#)\nrepeat until <touching (player v)?>\n    point in direction ((([sin v] of ((bounce) + (-50)) ) * (5)) + (90))\n    set size to ((([sin v] of (bounce) ) * (-5)) + (205)) %\n    change [bounce v] by (1)\nend\nrepeat until <not <(Game_Level) = (#)>>\n    point in direction ([direction v] of [player v])\n    set size to (205) %\n    go to (player v)\nend\n\n