Saving the Platformers - A Platformer                           #games
@Stage\n\nwhen flag clicked\nforever\n    if <(Mute) = [-1]> then\n        if <not <(Level) = [20]>> then\n            set volume to (Voliume) %\n        end\n    else\n        set volume to (0) %\n    end\nend\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nset [mute v] to [-1]\nforever\n    if <key (m v) pressed?> then\n        set [mute v] to ((-1) * (Mute))\n        wait (1) seconds\n    end\nend\n\nwhen I receive [ending v]\nswitch backdrop to (backdrop2 v)\n\nwhen I receive [intro end v]\nforever\n    play sound [The Cranberries - Zombie Piano Tutorial Midi v] until done\n    play sound [\[HQ\] Adam Lambert - Whataya Want From Me \(Piano cover\) v] until done\n    play sound [Boulevard Of Broken Dreams - Green Day - \(Piano Cover\) v] until done\nend\n\nwhen flag clicked\nset volume to (100) %\nset [voliume v] to [100]\nforever\n    if <(Level) = [20]> then\n        repeat (50)\n            change volume by (-2)\n            change [voliume v] by (-2)\n        end\n        stop all sounds\n        stop [other scripts in sprite v]\n        broadcast (Next Songf v)\n        repeat until <(Level) = [21]>\n            play sound [The Cranberries - Zombie \(Instrumental\) v] until done\n        end\n    end\nend\n\nwhen I receive [next songf v]\nwait (1) seconds\nrepeat (75)\n    change volume by (1)\n    change [voliume v] by (1)\nend\nwait until <(Level) = [21]>\nrepeat (50)\n    change volume by (-2)\n    change [voliume v] by (-2)\nend\nstop all sounds\nset volume to (100) %\nset [voliume v] to [100]\nforever\n    play sound [The Cranberries - Zombie Piano Tutorial Midi v] until done\nend\n\nwhen I receive [next songf v]\nswitch backdrop to (backdrop1 v)\nset [mute v] to [-1]\nforever\n    if <key (m v) pressed?> then\n        set [mute v] to ((-1) * (Mute))\n        wait (1) seconds\n    end\nend\n\nwhen I receive [next songf v]\nforever\n    if <(Mute) = [-1]> then\n        set volume to (Voliume) %\n    else\n        set volume to (0) %\n    end\nend\n\n@Intro_INFNTY\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (0)\ngo to x: (-7) y: (-17)\nswitch costume to (costume1 v)\nhide\nwait (1) seconds\nstart sound [Breaker Light v]\nstart sound [Light-Electric-Buzzing-www v]\nshow\nwait (1) seconds\nrepeat (22)\n    next costume\nend\nbroadcast (message1 v)\n\nwhen flag clicked\nwait (7.25) seconds\nstart sound [Fade v]\n\nwhen I receive [intro end v]\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\n\n@Intro_INFNTY_logo\n\nwhen I receive [message1 v]\nwait (1) seconds\nshow\nglide (0.2) secs to x: (4) y: (-10)\nstart sound [Boom v]\n\nwhen flag clicked\nswitch costume to (infntyframed v)\nset [ghost v] effect to (0)\nhide\ngo to x: (-4) y: (253)\nwait (0.5) seconds\ngo to [front v] layer\n\nwhen I receive [intro end v]\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\n\n@Intro_Arm\n\nwhen flag clicked\nset [ghost v] effect to (0)\nswitch costume to (costume1 v)\nset [intro y v] to [15]\nhide\nwait (1) seconds\ngo to [front v] layer\nshow\ngo to (intro_infnty v)\npoint in direction (90)\nwait (1) seconds\nrepeat (15)\n    turn right (11) degrees\nend\nrepeat (4)\n    repeat (5)\n        turn left (10) degrees\n    end\n    repeat (5)\n        turn left (-10) degrees\n    end\nend\n\nwhen I receive [message1 v]\nwait until <touching (intro_infnty_logo v)?>\nif <touching (intro_infnty_logo v)?> then\n    switch costume to (costume2 v)\n    repeat (33)\n        turn left (15.9) degrees\n        change x by (-5)\n        change y by (Intro y)\n        change [intro y v] by (-1.15)\n    end\n    wait (0.5) seconds\n    next costume\nend\n\nwhen I receive [intro end v]\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\n\n@Intro_Blind\n\nwhen flag clicked\nset [ghost v] effect to (0)\nshow\ngo to x: (-84) y: (-146)\nwait (3) seconds\ngo to [front v] layer\nwait until <touching (intro_arm v)?>\nif <touching (intro_arm v)?> then\n    repeat (20)\n        change x by (10)\n    end\nend\nhide\nwait (1) seconds\nbroadcast (Intro End v)\n\n@Player\n\nwhen flag clicked\nhide\nset [allow move v] to [0]\n\nwhen I receive [begin v]\nset [allow move v] to [0]\nset [allow portal v] to [1]\nset [auto-right v] to [0]\nset [x2 v] to [0]\nset [y2 v] to [0]\ngo to x: (-192) y: (-100)\nset rotation style [left-right v]\npoint in direction (90)\nshow\nforever\n    if <<<<<key (right arrow v) pressed?> or <key (d v) pressed?>> and <(Allow Move) = [1]>> and <(Text) = [0]>> or <(Auto-Right) = [1]>> then\n        change [x2 v] by (1)\n        point in direction (90)\n    end\n    if <<<<key (left arrow v) pressed?> or <key (a v) pressed?>> and <(Allow Move) = [1]>> and <(Text) = [0]>> then\n        change [x2 v] by (-1)\n        point in direction (-90)\n    end\n    set [x2 v] to ((x2) * (0.9))\n    change x by (x2)\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(Allow Move) = [1]>> and <(Text) = [0]>> then\n                                change x by ((x2) * (-1))\n                                change y by (-5)\n                                if <(x2) > [0]> then\n                                    set [x2 v] to [-7]\n                                else\n                                    set [x2 v] to [7]\n                                end\n                                set [y2 v] to [10]\n                            else\n                                set [x2 v] to ((x2) * (-1.3))\n                                change x by (x2)\n                                set [x2 v] to [0]\n                                change x by ((x2) / (5))\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y2 v] by (-1)\n    change y by (y2)\n    if <touching (ground v)?> then\n        change y by ((y2) * (-1))\n        set [y2 v] to [0]\n    end\n    change y by (-1)\n    if <touching (ground v)?> then\n        if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(Allow Move) = [1]>> and <(Text) = [0]>> then\n            set [y2 v] to [15]\n        end\n    end\n    change y by (1)\n    if <touching (ground v)?> then\n        change x by ((x2) * (-1))\n        change y by (-5)\n    end\n    if <touching (ground v)?> then\n        change y by ((y2) * (-1))\n        set [y2 v] to [0]\n    end\n    if <<touching (portal v)?> and <(Allow Portal) = [1]>> then\n        if <(Level) = [20]> then\n            broadcast (End v)\n            set [allow move v] to [0]\n            wait (2) seconds\n        end\n        broadcast (Next v)\n    end\n    if <<(Die Again) = [1]> and <<touching (spikes v)?> or <<touching (fireball v)?> or <<<touching (head v)?> or <touching (boss v)?>> or <[-185] > (y position)>>>>> then\n        broadcast (Pre-Death v)\n        set [die again v] to [0]\n        wait until <(Die Again) = [1]>\n    end\nend\n\nwhen I receive [begin v]\nforever\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(Allow Move) = [1]>> and <(Text) = [0]>> then\n        switch costume to (jumping v)\n    else\n        if <<<(Text) = [0]> and <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> and <(Allow Move) = [1]>>> or <(Auto-Right) = [1]>> then\n            if <(costume [name v]) = [Standing 10]> then\n                switch costume to (standing 1 v)\n            else\n                next costume\n            end\n            wait (0.01) seconds\n        else\n            switch costume to (standing 1 v)\n        end\n    end\nend\n\nwhen I receive [begin v]\nchange [☁ amount of people v] by (1)\nforever\n    set [player x v] to (x position)\n    set [player y v] to (y position)\nend\n\nwhen I receive [next v]\nif <(Level) = [20]> then\n    hide\n    set [y2 v] to [0]\n    set [x2 v] to [0]\n    set [arm side v] to [-5]\n    point in direction (90)\n    wait (2) seconds\n    go to x: (-250) y: (-100)\n    show\n    set [auto-right v] to [1]\n    wait (0.5) seconds\n    set [auto-right v] to [0]\nelse\n    go to x: (-192) y: (-100)\n    set [y2 v] to [0]\n    set [x2 v] to [0]\n    set [arm side v] to [-5]\n    point in direction (90)\nend\n\nwhen I receive [death v]\nset [brightness v] effect to (0)\nset [ghost v] effect to (0)\ngo to x: (-192) y: (-100)\nset [y2 v] to [0]\nset [x2 v] to [0]\nset [arm side v] to [-5]\npoint in direction (90)\n\nwhen [r v] key pressed\nbroadcast (Pre-Death v)\n\nwhen I receive [follow v]\nset [allow move v] to [0]\nwait (3) seconds\nset [auto-right v] to [1]\nwait until <touching (_edge_ v)?>\nbroadcast (Ending v)\ngo to x: (-250) y: (-127)\nset [auto-right v] to [0]\n\nwhen I receive [endinging v]\nset [auto-right v] to [1]\nwait until <touching (_edge_ v)?>\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen I receive [almost leave v]\nset [auto-right v] to [1]\nwait (0.5) seconds\nset [auto-right v] to [0]\npoint in direction (-90)\n\nwhen I receive [begin v]\nforever\n    if <key (p v) pressed?> then\n        if <<(Text) = [0]> and <(Allow Portal) = [1]>> then\n            go to (portal v)\n            wait (3) seconds\n        end\n    end\n    if <(Level) = [21]> then\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Mute) = [-1]> then\n        set volume to (100) %\n    else\n        set volume to (0) %\n    end\nend\n\nwhen I receive [pre-death v]\nset [die again v] to [0]\nset [allow move v] to [0]\nset [x2 v] to [0]\nset [y2 v] to [0]\nstart sound [Hit Enemy v]\nrepeat (5)\n    change [brightness v] effect by (-10)\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nbroadcast (Death v)\nset [die again v] to [1]\n\n@Arm\n\nwhen flag clicked\nhide\n\nwhen I receive [begin v]\npoint in direction (90)\nset [arm side v] to [-5]\nset [allow weapon v] to [0]\nset [weapon v] to [0]\nshow\nforever\n    go to x: ((Player x) + (Arm Side)) y: ((player y) - (1))\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> and <(Allow Move) = [1]>> then\n        set [arm side v] to [5]\n    end\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> and <(Allow Move) = [1]>> then\n        set [arm side v] to [-5]\n    end\n    change x by (x2)\n    change y by (y2)\nend\n\nwhen I receive [begin v]\nforever\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> and <(Allow Move) = [1]>> then\n            repeat (2)\n                turn left (10) degrees\n                wait (0.01) seconds\n            end\n            repeat (4)\n                turn left (-10) degrees\n                wait (0.01) seconds\n            end\n            repeat (2)\n                turn left (10) degrees\n                wait (0.01) seconds\n            end\n            point in direction (90)\n        end\n        if <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> and <(Allow Move) = [1]>> or <(Auto-Right) = [1]>> then\n            repeat (2)\n                turn left (-10) degrees\n                wait (0.01) seconds\n            end\n            repeat (4)\n                turn left (10) degrees\n                wait (0.01) seconds\n            end\n            repeat (2)\n                turn left (-10) degrees\n                wait (0.01) seconds\n            end\n            point in direction (90)\n        end\n    end\nend\n\nwhen I receive [begin v]\nforever\n    if <<key (space v) pressed?> and <(Allow Move) = [1]>> then\n        if <<(Weapon) = [1]> or <(Weapon) = [0]>> then\n            if <(Arm Side) = [5]> then\n                if <(Weapon) = [1]> then\n                    set [sword damage v] to [1]\n                    start sound [Sword Swing v]\n                end\n                repeat (10)\n                    turn left (36) degrees\n                end\n                wait (0.1) seconds\n                set [sword damage v] to [0]\n            else\n                if <(Weapon) = [1]> then\n                    set [sword damage v] to [1]\n                    start sound [Sword Swing v]\n                end\n                repeat (10)\n                    turn left (-36) degrees\n                end\n                wait (0.1) seconds\n                set [sword damage v] to [0]\n            end\n            point in direction (90)\n            wait (0.4) seconds\n        end\n    end\n    if <<(Text) = [0]> and <<<key (space v) pressed?> and <(Weapon) = [2]>> and <(Arrow Allow) = [1]>>> then\n        set [arm direction v] to ((direction) + (90))\n        set [allow move v] to [0]\n        broadcast (Arrow v)\n        switch costume to (bow 2 v)\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            turn left (5) degrees\n        end\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            turn left (-5) degrees\n        end\n        if <not <<key (space v) pressed?> and <(Weapon) = [2]>>> then\n            point in direction (90)\n        end\n    else\n        if <<(Die Again) = [0]> or <<(Text) = [1]> or <(Level) = [21]>>> then\n            set [allow move v] to [0]\n        else\n            set [allow move v] to [1]\n        end\n    end\n    if <(Level) = [21]> then\n        stop [this script v]\n    end\nend\n\nwhen I receive [begin v]\nforever\n    if <(Weapon) = [0]> then\n        switch costume to (costume1 v)\n    else\n        if <(Weapon) = [1]> then\n            if <(Arm Side) = [5]> then\n                switch costume to (sword 2 v)\n            else\n                switch costume to (sword 1 v)\n            end\n        else\n            if <<(Weapon) = [2]> and <not <key (space v) pressed?>>> then\n                switch costume to (bow 1 v)\n            end\n        end\n    end\nend\n\nwhen I receive [pre-death v]\nrepeat (5)\n    change [brightness v] effect by (-10)\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [death v]\nif <(Level) = [5]> then\n    set [allow weapon v] to [0]\n    set [weapon v] to [0]\nend\nif <(Level) = [10]> then\n    set [allow weapon v] to [1]\n    set [weapon v] to [1]\nend\n\nwhen I receive [begin v]\nforever\n    if <(Allow Weapon) = [0]> then\n        set [weapon v] to [0]\n    else\n        if <(Allow Weapon) = [1]> then\n            if <(Allow Move) = [1]> then\n                if <key (0 v) pressed?> then\n                    point in direction (90)\n                    set [weapon v] to [0]\n                end\n                if <key (1 v) pressed?> then\n                    point in direction (90)\n                    set [weapon v] to [1]\n                end\n            end\n        else\n            if <(Allow Weapon) = [2]> then\n                if <(Allow Move) = [1]> then\n                    if <key (0 v) pressed?> then\n                        set [weapon v] to [0]\n                    end\n                    if <key (1 v) pressed?> then\n                        set [weapon v] to [1]\n                    end\n                    if <key (2 v) pressed?> then\n                        set [weapon v] to [2]\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [next v]\npoint in direction (90)\nif <(Level) = [20]> then\n    hide\n    point in direction (90)\n    wait (2) seconds\n    show\nend\n\nwhen I receive [endinging v]\nwait until <touching (_edge_ v)?>\nhide\nstop [other scripts in sprite v]\nstop [this script v]\n\nwhen I receive [almost leave v]\nwait (0.5) seconds\nset [arm side v] to [5]\n\nwhen I receive [endinging v]\nset [arm side v] to [-5]\n\nwhen I receive [end v]\nforever\n    set [allow move v] to [0]\nend\n\nwhen I receive [player wave v]\nwait (1) seconds\nrepeat (10)\n    turn right (36) degrees\nend\n\nwhen I receive [player small wave v]\nwait (1) seconds\nrepeat (10)\n    turn right (5) degrees\nend\nrepeat (10)\n    turn right (-5) degrees\nend\n\nwhen I receive [death v]\nset [ghost v] effect to (0)\nset [brightness v] effect to (0)\n\nwhen flag clicked\nforever\n    if <(Mute) = [-1]> then\n        set volume to (100) %\n    else\n        set volume to (0) %\n    end\nend\n\n@Particles\n\nwhen flag clicked\nrepeat (10)\n    create clone of (_myself_ v)\n    wait (pick random (0.5) to (1)) seconds\nend\nhide\n\nwhen I start as a clone\nshow\ngo to x: (-200) y: (pick random (200) to (0))\nset [ghost v] effect to (0)\nrepeat (pick random (100) to (120))\n    change x by (4)\n    change y by (-1)\n    change [ghost v] effect by (1)\nend\ncreate clone of (_myself_ v)\ndelete this clone\n\n@Mountains2\n\nwhen flag clicked\nhide\n\nwhen I receive [begin v]\nshow\ngo to [back v] layer\nforever\n    go to x: ((Player x) / (15)) y: ((player y) / (12))\nend\n\n@Mountains\n\nwhen flag clicked\nhide\n\nwhen I receive [begin v]\nshow\ngo to [back v] layer\nforever\n    go to x: ((Player x) / (10)) y: ((player y) / (10))\nend\n\n@Portal\n\nwhen flag clicked\nhide\n\nwhen I receive [begin v]\nshow\ngo to x: (204) y: (-109)\nforever\n    repeat (40)\n        change y by (0.1)\n        turn right (1) degrees\n        wait until <(Text) = [0]>\n    end\n    repeat (40)\n        change y by (-0.1)\n        turn right (1) degrees\n        wait until <(Text) = [0]>\n    end\nend\n\nwhen I receive [next v]\nif <(Level) = [5]> then\n    go to x: (207) y: (104)\nelse\n    if <(Level) = [7]> then\n        go to x: (-199) y: (96)\n    else\n        if <(Level) = [10]> then\n            go to x: (193) y: (140)\n        else\n            if <(Level) = [12]> then\n                go to x: (202) y: (105)\n            else\n                if <(Level) = [15]> then\n                    go to x: (-195) y: (137)\n                else\n                    if <(Level) = [19]> then\n                        go to x: (208) y: (128)\n                    else\n                        if <(Level) = [20]> then\n                            hide\n                            change [☁ amount of pass v] by (1)\n                            stop [other scripts in sprite v]\n                        else\n                            go to x: (204) y: (-107)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [next v]\nif <(Level) = [4]> then\n    set [allow portal v] to [0]\nelse\n    if <(Level) = [9]> then\n        set [allow portal v] to [0]\n    else\n        if <(Level) = [19]> then\n            set [allow portal v] to [0]\n            wait until <[2] > (Life)>\n            set [allow portal v] to [1]\n        else\n            if <(Level) = [20]> then\n                hide\n            else\n                set [allow portal v] to [1]\n            end\n        end\n    end\nend\n\nwhen I receive [death v]\nif <(Level) = [5]> then\n    set [allow portal v] to [0]\nelse\n    if <(Level) = [10]> then\n        set [allow portal v] to [0]\n    else\n        if <<(Level) = [20]> and <(Life) > [2]>> then\n            set [allow portal v] to [0]\n        else\n            set [allow portal v] to [1]\n        end\n    end\nend\n\n@Backdrop\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\ngo to [back v] layer\nset [ghost v] effect to (0)\n\nwhen I receive [begin v]\nshow\nforever\n    if <not <(Level) = [21]>> then\n        go to [back v] layer\n    end\nend\n\nwhen I receive [next v]\nchange [ghost v] effect by (1)\n\nwhen I receive [ending v]\nswitch costume to (costume2 v)\ngo to [front v] layer\n\nwhen I receive [endinging v]\nwait (7) seconds\nhide\n\n@Enemy\n\nwhen flag clicked\nhide\n\nwhen I receive [next v]\nwait (0.01) seconds\nEnemy Code\nset [clone death v] to [1]\nset [clone death v] to [0]\n\ndefine Enemy Code\nstop [other scripts in sprite v]\nset [enemy 1 harm v] to [1]\nbroadcast (kill v)\nif <(Level) = [4]> then\n    Enemy [-42] [-83] [10] [90] [1]\nelse\n    if <(Level) = [5]> then\n        Enemy [0] [-127] [10] [90] [1]\n    else\n        if <(Level) = [6]> then\n            Enemy [40] [-7] [9] [90] [1]\n        else\n            if <(Level) = [8]> then\n                Enemy [0] [-127] [20] [-90] [1]\n            else\n                if <(Level) = [9]> then\n                    Enemy [200] [107] [70] [0] [2]\n                else\n                    if <(Level) = [10]> then\n                        Enemy [200] [0] [70] [0] [2]\n                    else\n                        if <(Level) = [11]> then\n                            Enemy [0] [100] [70] [0] [2]\n                        else\n                            if <(Level) = [13]> then\n                                Enemy [-40] [50] [70] [0] [2]\n                            else\n                                if <(Level) = [14]> then\n                                    Enemy [-40] [63] [3] [90] [1]\n                                else\n                                    if <(Level) = [15]> then\n                                        Enemy [200] [70] [50] [0] [2]\n                                    else\n                                        if <(Level) = [16]> then\n                                            Enemy [188] [43] [1] [90] [1]\n                                        else\n                                            if <(Level) = [17]> then\n                                                Enemy [56] [-2] [5] [-90] [1]\n                                            else\n                                                if <(Level) = [18]> then\n                                                    Enemy [40] [50] [30] [0] [2]\n                                                else\n                                                    if <(Level) = [19]> then\n                                                        Enemy [20] [-127] [7] [-90] [1]\n                                                    else\n                                                        hide\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Enemy (xpos) (ypos) (steps) ( direction) (w/g)\nshow\ngo to x: (xpos) y: (ypos)\nset [enmy steps 1 v] to (steps)\npoint in direction ( direction)\nset [ghost v] effect to (0)\nif <(w/g) = [1]> then\n    switch costume to (walker 1 v)\n    set size to (100) %\n    wait until <(Text) = [0]>\n    broadcast (Enemy Walk v)\nelse\n    if <(w/g) = [2]> then\n        switch costume to (glider 1 v)\n        set size to (50) %\n        set rotation style [all around v]\n        broadcast (Enemy Fly v)\n        set [enemy; glide x 1 v] to [-2]\n        wait until <(Text) = [0]>\n    end\nend\n\nwhen I receive [death v]\nwait (0.2) seconds\nEnemy Code\n\nwhen I receive [enemy walk v]\nset rotation style [left-right v]\nrepeat (Enmy Steps 1)\n    switch costume to (walker 1 v)\n    move (10) steps\n    wait (0.05) seconds\n    repeat (7)\n        next costume\n        wait until <(Text) = [0]>\n        wait (0.05) seconds\n    end\nend\nturn right (180) degrees\nbroadcast (Enemy Walk v)\n\nwhen I receive [enemy fly v]\nrepeat (Enmy Steps 1)\n    change x by (Enemy; Glide x 1)\n    if <(costume [number v]) = [16]> then\n        switch costume to (glider 1 v)\n    else\n        next costume\n    end\n    wait (0.05) seconds\n    wait until <(Text) = [0]>\nend\nset [enemy; glide x 1 v] to ((Enemy; Glide x 1) * (-1))\nbroadcast (Enemy Fly v)\n\nwhen I receive [enemy fly v]\nwait until <(distance to [player v]) < [170]>\nstop [other scripts in sprite v]\nbroadcast (kill v)\ncreate clone of (_myself_ v)\nrepeat (10)\n    turn right (Enemy; Glider clone Direction) degrees\n    wait until <(Text) = [0]>\nend\nrepeat until <touching (_edge_ v)?>\n    move (15) steps\n    wait until <(Text) = [0]>\nend\nhide\n\nwhen I start as a clone\nhide\npoint towards (player v)\nset [enemy; glider clone direction v] to ((direction) / (10))\ndelete this clone\n\nwhen I receive [kill v]\nforever\n    if <<<touching (arm v)?> and <(Sword Damage) = [1]>> or <touching (arrows v)?>> then\n        set [enemy 1 harm v] to [0]\n        repeat (5)\n            change [ghost v] effect by (20)\n        end\n        hide\n        delete this clone\n    end\n    if <<touching (player v)?> and <(Enemy 1 Harm) = [1]>> then\n        broadcast (Pre-Death v)\n        stop [this script v]\n    end\nend\n\n@Enemy2\n\nwhen flag clicked\nhide\nswitch costume to (walker 1 v)\n\nwhen I receive [next v]\nwait (0.01) seconds\nEnemy Code\n\ndefine Enemy Code\nset [enemy 2 harm v] to [1]\nif <(Level) = [8]> then\n    Enemy [-30] [40] [5] [90] [1]\nelse\n    if <(Level) = [10]> then\n        Enemy [-80] [-127] [8] [90] [1]\n    else\n        if <(Level) = [11]> then\n            Enemy [100] [-1] [9] [90] [1]\n        else\n            if <(Level) = [12]> then\n                Enemy [132] [18] [8] [90] [1]\n            else\n                if <(Level) = [13]> then\n                    Enemy [40] [88] [8] [90] [9]\n                else\n                    if <(Level) = [16]> then\n                        Enemy [20] [103] [6] [90] [9]\n                    else\n                        if <(Level) = [17]> then\n                            Enemy [-150] [114] [30] [90] [1]\n                        else\n                            if <(Level) = [18]> then\n                                Enemy [40] [132] [2] [-90] [9]\n                            else\n                                if <(Level) = [19]> then\n                                    Enemy [130] [58] [3] [90] [9]\n                                else\n                                    hide\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Enemy (xpos) (ypos) (steps) (direction) (w/g)\nshow\nset rotation style [left-right v]\ngo to x: (xpos) y: (ypos)\nset [enmy steps 2 v] to (steps)\nset [enemy 2; type v] to (w/g)\npoint in direction (direction)\nset [ghost v] effect to (0)\nwait until <(Text) = [0]>\nbroadcast (Enemy Walk 2 v)\n\nwhen I receive [death v]\nwait (0.2) seconds\nEnemy Code\n\nwhen I receive [enemy walk 2 v]\nrepeat (Enmy Steps 2)\n    switch costume to (Enemy 2; Type)\n    move (10) steps\n    wait (0.05) seconds\n    repeat (7)\n        next costume\n        wait until <(Text) = [0]>\n        wait (0.05) seconds\n    end\nend\nturn right (180) degrees\nbroadcast (Enemy Walk 2 v)\n\nwhen I receive [kill v]\nforever\n    if <<<touching (arm v)?> and <(Sword Damage) = [1]>> or <<touching (arrows v)?> and <(Enemy 2; Type) = [1]>>> then\n        set [enemy 2 harm v] to [0]\n        repeat (5)\n            change [ghost v] effect by (20)\n        end\n        hide\n        delete this clone\n    end\n    if <<touching (player v)?> and <(Enemy 2 Harm) = [1]>> then\n        broadcast (Pre-Death v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [begin v]\nwait until <<touching (arrows v)?> and <(Enemy 2; Type) = [9]>>\nbroadcast (Enenmy Text v)\n\n@Chest\n\nwhen flag clicked\nhide\n\nwhen I receive [next v]\nif <(Level) = [4]> then\n    switch costume to (closed v)\n    show\n    go to x: (184) y: (109)\nelse\n    if <(Level) = [9]> then\n        switch costume to (closed v)\n        show\n        go to x: (55) y: (91)\n    else\n        hide\n    end\nend\n\nwhen I receive [begin v]\nforever\n    if <<touching (player v)?> and <(costume [number v]) = [1]>> then\n        set [brightness v] effect to (15)\n    else\n        set [brightness v] effect to (0)\n    end\n    if <<(Text) = [0]> and <<<key (down arrow v) pressed?> or <key (s v) pressed?>> and <<touching (player v)?> and <(costume [number v]) = [1]>>>> then\n        switch costume to (opened v)\n        broadcast (Loot v)\n    end\nend\n\nwhen I receive [death v]\nif <(Level) = [5]> then\n    switch costume to (closed v)\n    show\n    go to x: (184) y: (109)\nelse\n    if <(Level) = [10]> then\n        switch costume to (closed v)\n        show\n        go to x: (55) y: (91)\n    else\n        hide\n    end\nend\n\nwhen I receive [begin v]\nwait until <touching (player v)?>\nset [x2 v] to [0]\nset [y2 v] to [0]\nbroadcast (Chest instructions v)\n\n@Boss\n\nwhen flag clicked\nhide\n\nwhen I receive [next v]\nif <(Level) = [19]> then\n    point in direction (-90)\n    set [ghost v] effect to (0)\n    show\n    set [life v] to [11]\n    broadcast (Boss Show v)\n    forever\n        if <<<touching (arm v)?> and <(Sword Damage) = [1]>> or <<touching (arrows v)?> and <not <(Boss Arrow Chance) = [1]>>>> then\n            change [life v] by (-1)\n            wait (0.1) seconds\n        end\n        if <[2] > (Life)> then\n            repeat (10)\n                change [ghost v] effect by (10)\n                set [allow portal v] to [1]\n            end\n            hide\n            stop [other scripts in sprite v]\n            stop [this script v]\n        end\n    end\nelse\n    hide\nend\n\nwhen I receive [boss show v]\nset [attack v] to [0]\ngo to x: (101) y: (114)\npoint in direction (90)\nbroadcast (Boss Walk v)\n\nwhen I receive [boss walk v]\nset rotation style [left-right v]\nrepeat until <<(x position) > [161]> or <[101] > (x position)>>\n    switch costume to (walker 1 v)\n    move (10) steps\n    wait (0.05) seconds\n    repeat (7)\n        next costume\n        wait until <(Text) = [0]>\n        wait (0.05) seconds\n    end\n    if <(Attack) = [1]> then\n        switch costume to (standing v)\n        broadcast (Attack v)\n        stop [this script v]\n    end\nend\nturn right (180) degrees\nswitch costume to (walker 1 v)\nmove (10) steps\nwait (0.05) seconds\nrepeat (7)\n    next costume\n    wait (0.05) seconds\nend\nif <(Attack) = [1]> then\n    set [attack; head v] to (direction)\n    switch costume to (standing v)\n    broadcast (Attack v)\n    stop [this script v]\nend\nbroadcast (Boss Walk v)\n\nwhen I receive [boss show v]\nforever\n    wait (pick random (3) to (6)) seconds\n    wait until <(Text) = [0]>\n    if <[1] < (Life)> then\n        set [attack v] to [1]\n    end\nend\n\nwhen I receive [boss show v]\nwait until <[2] > (Life)>\nrepeat until <(Level) = [21]>\n    set [allow portal v] to [1]\nend\n\nset [allow weapon v] to [2]\n\n@Fireball\n\nwhen flag clicked\nhide\n\nwhen I receive [attack v]\nset [attack type v] to (pick random (1) to (4))\nhide\nwait (1) seconds\ngo to (boss v)\nif <(Attack type) = [1]> then\n    point in direction (Attack; Head)\nelse\n    point in direction ((Attack; Head) + (8))\nend\nset [fireball damage v] to [0]\nif <(Attack type) = [1]> then\n    create clone of (_myself_ v)\nelse\n    repeat (5)\n        wait until <(Text) = [0]>\n        create clone of (_myself_ v)\n        turn left (4) degrees\n    end\nend\n\nwhen I start as a clone\ngo to [front v] layer\nswitch costume to (costume1 v)\nif <(Mute) = [-1]> then\n    start sound [FireIgnite v]\nend\nif <(Attack type) = [1]> then\n    set size to (200) %\n    set [color v] effect to (100)\nelse\n    set size to (100) %\n    set [color v] effect to (0)\nend\nshow\nrepeat until <<<touching (boss v)?> and <(Fireball Damage) = [1]>> or <<touching (player v)?> or >>\n    if <(Attack type) = [1]> then\n        move (17) steps\n    else\n        move (15) steps\n    end\n    wait until <(Text) = [0]>\n    if <<not <(Attack type) = [1]>> and <<touching (arm v)?> and <(Sword Damage) = [1]>>> then\n        turn right (180) degrees\n        set [fireball damage v] to [1]\n    end\n    if <<<touching (boss v)?> or <touching (head v)?>> and <(Fireball Damage) = [1]>> then\n        change [life v] by (-1)\n    end\nend\nif <(Attack type) = [1]> then\n    if <(Mute) = [-1]> then\n        start sound [e4_b v]\n    end\n    repeat (11)\n        next costume\n        change size by (7)\n        wait (0.0001) seconds\n    end\nend\ndelete this clone\n\n@Health Bar\n\nwhen I receive [boss show v]\nshow\nif <(Allow Move) = [1]> then\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\nend\n\nwhen I receive [boss show v]\nforever\n    go to (boss v)\n    if <[2] > (Life)> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        set [allow portal v] to [1]\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nset [ghost v] effect to (1)\nhide\n\nwhen I receive [boss show v]\nforever\n    switch costume to (Life)\nend\n\n@text\n\nwhen flag clicked\nhide\n\nwhen I receive [begin v]\nset [text v] to [1]\nwait (2) seconds\nText [1]\n\nwhen I receive [next v]\nif <(Level) = [1]> then\n    Text [2]\n    Text [3]\nelse\n    if <(Level) = [2]> then\n        Text [4]\n        Text [5]\n        Text [6]\n    else\n        if <(Level) = [3]> then\n            Text [7]\n        else\n            if <(Level) = [4]> then\n                Text [8]\n            else\n                if <(Level) = [5]> then\n                    Text [10]\n                else\n                    if <(Level) = [7]> then\n                        Text [11]\n                        Text [12]\n                    else\n                        if <(Level) = [8]> then\n                            Text [13]\n                        else\n                            if <(Level) = [10]> then\n                                Text [14]\n                                Text [15]\n                                Text [16]\n                            else\n                                if <(Level) = [11]> then\n                                    Text [20]\n                                    Text [21]\n                                else\n                                    if <(Level) = [17]> then\n                                        Text [22]\n                                    else\n                                        if <(Level) = [18]> then\n                                            Text [23]\n                                        else\n                                            if <(Level) = [19]> then\n                                                wait (1) seconds\n                                                Text [24]\n                                                Text [25]\n                                                Text [26]\n                                                Text [27]\n                                                Text [28]\n                                                Text [29]\n                                                Text [30]\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Text (costume)\nif <(Toggle Text) = [-1]> then\n    set [text v] to [1]\n    switch costume to (costume)\n    set [pixelate v] effect to (100)\n    show\n    repeat (50)\n        change [pixelate v] effect by (-2)\n    end\n    wait (3) seconds\n    repeat (50)\n        change [pixelate v] effect by (2)\n    end\n    hide\n    set [text v] to [0]\n    set [allow move v] to [1]\nend\n\nwhen I receive [chest instructions v]\nText [9]\n\nwhen I receive [loot text v]\nText [17]\n\nwhen I receive [enenmy text v]\nText [18]\nText [19]\n\nwhen I receive [end v]\nwait (3) seconds\nText [31]\nText [32]\nText [33]\nbroadcast (Res Wave v)\nText [34]\nbroadcast (Player Wave v)\nText [35]\nbroadcast (Follow v)\nText [36]\n\nwhen I receive [follow v]\nwait (8) seconds\ngo to [front v] layer\nText [37]\nText [38]\nText [39]\nText [40]\nText [41]\nText [42]\nText [43]\nbroadcast (Almost Leave v)\nText [44]\nbroadcast (Res Wave v)\nText [45]\nbroadcast (Player Small Wave v)\nText [46]\nbroadcast (Endinging v)\nwait (3) seconds\nText [47]\n\nwhen I receive [begin v]\nset [toggle text v] to [-1]\nforever\n    if <key (t v) pressed?> then\n        set [toggle text v] to ((Toggle Text) * (-1))\n        if <(Toggle Text) = [1]> then\n            set [ghost v] effect to (100)\n        else\n            set [ghost v] effect to (0)\n        end\n        wait (0.5) seconds\n    end\n    if <(Toggle Text) = [1]> then\n        set [text v] to [0]\n        switch costume to (nada v)\n        show\n        clear graphic effects\n    end\n    if <<(Toggle Text) = [-1]> and <(Text) = [0]>> then\n        hide\n    end\n    if <(Level) = [21]> then\n        set [toggle text v] to [-1]\n        stop [this script v]\n    end\nend\n\n@Res\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nwait (2) seconds\nswitch costume to (costume1 v)\ngo to x: (89) y: (-128)\nshow\nset rotation style [left-right v]\npoint in direction (-90)\n\nwhen I receive [follow v]\nwait (1.5) seconds\nrepeat until <touching (_edge_ v)?>\n    next costume\n    wait (0.01) seconds\nend\nhide\nswitch costume to (costume1 v)\n\nwhen I receive [follow v]\nwait (1.5) seconds\npoint in direction (90)\nrepeat until <touching (_edge_ v)?>\n    move (5) steps\nend\nhide\n\nwhen I receive [ending v]\nshow\ngo to x: (-100) y: (-127)\n\nwhen I receive [res wave v]\nwait (1) seconds\nswitch costume to (wave 1 v)\nrepeat (3)\n    next costume\n    wait (0.05) seconds\nend\nrepeat (3)\n    switch costume to ((costume [number v]) - (1))\n    wait (0.05) seconds\nend\nswitch costume to (costume1 v)\n\n@Thumbnail\n\nwhen flag clicked\nshow\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\ngo to [front v] layer\n\nwhen I receive [endinging v]\nwait (7) seconds\nset [ghost v] effect to (0)\nswitch costume to (costume2 v)\n\n@Ground\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\nset [level v] to [1]\n\nwhen I receive [next v]\nnext costume\n\nwhen I receive [begin v]\nswitch costume to (costume1 v)\nset [level v] to [1]\nshow\nforever\n    set [level v] to (costume [number v])\nend\n\nset [allow weapon v] to [2]\n\n@Spikes\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\nwait (3) seconds\nshow\nforever\n    switch costume to (Level)\nend\n\n@Story Slide\n\nwhen flag clicked\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\n\nwhen I receive [intro end v]\nwait (2) seconds\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nrepeat (6)\n    repeat (50)\n        change [ghost v] effect by (-2)\n    end\n    wait (3) seconds\n    if <(costume [number v]) = [6]> then\n        broadcast (Begin v)\n    end\n    repeat (50)\n        change [ghost v] effect by (2)\n    end\n    next costume\nend\nhide\n\nwhen I receive [end v]\nswitch costume to (costume7 v)\nset [ghost v] effect to (100)\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nwait (1) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\n\nwhen I receive [endinging v]\nwait (5) seconds\nset [ghost v] effect to (100)\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nwait (1) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\nend\n\nwhen I receive [intro end v]\nset [begin v] to [0]\nrepeat until <(Begin) = [1]>\n    if <key (s v) pressed?> then\n        broadcast (Begin v)\n        stop [other scripts in sprite v]\n        repeat (50)\n            change [ghost v] effect by (2)\n        end\n        hide\n        stop [this script v]\n    end\nend\n\nwhen I receive [begin v]\nset [begin v] to [1]\n\n@Loot\n\nwhen flag clicked\nhide\n\nwhen I receive [loot v]\nif <(Level) = [5]> then\n    switch costume to (costume1 v)\nend\nif <(Level) = [10]> then\n    switch costume to (costume2 v)\nend\nshow\nset [brightness v] effect to (100)\ngo to (chest v)\nset [loot y v] to [10]\nrepeat (20)\n    change y by (Loot y)\n    change [brightness v] effect by (-5)\n    change [loot y v] by (-1)\nend\nhide\nif <(Level) = [5]> then\n    set [allow weapon v] to [1]\n    set [allow portal v] to [1]\n    set [weapon v] to [1]\nend\nif <(Level) = [10]> then\n    set [allow weapon v] to [2]\n    set [allow portal v] to [1]\n    set [weapon v] to [2]\nend\n\nwhen I receive [death v]\nhide\n\nwhen I receive [begin v]\nwait until <(Allow Weapon) = [2]>\nset [player x v] to [0]\nset [player y v] to [0]\nbroadcast (Loot Text v)\nset [arrow allow v] to [1]\n\n@Arrows\n\nwhen I start as a clone\nset [boss arrow chance v] to (pick random (1) to (3))\nif <(Arrow Allow) = [1]> then\n    if <(Mute) = [-1]> then\n        start sound [Arrow Fly v]\n    end\n    set [arrow allow v] to [0]\n    show\n    repeat until <<touching (fireball v)?> or <<touching (head v)?> or <<touching (boss v)?> or <<touching (_edge_ v)?> or <<touching (ground v)?> or <<touching (enemy v)?> or <touching (enemy2 v)?>>>>>>>\n        if <(Arrow Side) = [right]> then\n            move ((15) - (Angle)) steps\n            turn right (Angle) degrees\n            if <(direction) > [90]> then\n                change [angle v] by ((Angle) * ((-1) * (0.1)))\n            else\n                change [angle v] by ((Angle) * (0.1))\n            end\n        else\n            move ((15) - ((-1) * (Angle))) steps\n            turn left (Angle) degrees\n            if <(direction) > [90]> then\n                change [angle v] by ((Angle) * ((-1) * (0.1)))\n            else\n                change [angle v] by ((Angle) * (0.1))\n            end\n        end\n    end\n    if <<<touching (_edge_ v)?> or <touching (ground v)?>> and <(Mute) = [-1]>> then\n        start sound [Arrow Hit Ground v]\n    end\n    if <<(Mute) = [-1]> and <<<touching (enemy2 v)?> and <(Enemy 2; Type) = [9]>> or <<<touching (head v)?> or <touching (boss v)?>> and <(Boss Arrow Chance) = [1]>>>> then\n        set [arrow bounce y v] to [7]\n        set [pitch v] effect to (10)\n        start sound [Arrow Deflected v]\n        repeat (10)\n            change y by (Arrow Bounce y)\n            change [ghost v] effect by (10)\n            change [arrow bounce y v] by (-1)\n            turn right (5) degrees\n        end\n    else\n        if <<touching (enemy v)?> or <<touching (enemy2 v)?> or <<touching (boss v)?> or <touching (head v)?>>>> then\n            if <(Mute) = [-1]> then\n                start sound [Hit Enemy v]\n            end\n        end\n    end\n    set [arrow allow v] to [1]\n    delete this clone\nend\n\nwhen I receive [arrow v]\nif <(Arrow Allow) = [1]> then\n    set [angle v] to [0.5]\n    go to (arm v)\n    repeat until <not <key (space v) pressed?>>\n        point in direction (Arm Direction)\n    end\n    if <(direction) > [0]> then\n        set [arrow side v] to [right]\n    else\n        set [arrow side v] to [left]\n    end\n    create clone of (_myself_ v)\nend\n\nwhen I receive [begin v]\nforever\n    if <<(Text) = [0]> and <<(Weapon) = [2]> and <key (space v) pressed?>>> then\n        show\n    else\n        hide\n    end\nend\n\nset [allow weapon v] to [1]\n\nwhen flag clicked\nforever\n    if <(Mute) = [-1]> then\n        set volume to (100) %\n    else\n        set volume to (0) %\n    end\nend\n\n@Head\n\nwhen flag clicked\nhide\n\nwhen I receive [attack v]\npoint in direction (0)\ngo to (boss v)\nchange y by (8)\ncreate clone of (_myself_ v)\nshow\nif <(Attack) = [1]> then\n    repeat (20)\n        turn right (Boss; Direction) degrees\n        wait until <(Text) = [0]>\n        set [attack; head v] to (direction)\n    end\n    wait (1) seconds\n    set [attack v] to [0]\n    wait until <(Text) = [0]>\n    broadcast (Boss Walk v)\n    hide\nelse\n    hide\nend\n\nwhen I start as a clone\nhide\ngo to (boss v)\npoint towards (player v)\nset [boss; direction v] to ((direction) / (20))\ndelete this clone\n\nwhen I receive [attack v]\nforever\n    if <(direction) > [0]> then\n        switch costume to (right v)\n    else\n        switch costume to (left v)\n    end\n    if <[2] > (Life)> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        hide\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\nwhen I receive [boss show v]\nset [ghost v] effect to (0)\nforever\n    if <<<touching (arm v)?> and <(Sword Damage) = [1]>> or <<<touching (arrows v)?> and <not <(Boss Arrow Chance) = [1]>>> or <<touching (fireball v)?> and <(Fireball Damage) = [1]>>>> then\n        change [life v] by (-1)\n        wait (0.5) seconds\n    end\nend\n\n