Improved Mega Man X Scrolling Platformer Engine

Instructions: ★★★★★★★INSTRUCTIONS★★★★★★★\n\n- Arrow keys or WASD to move and jump\n- Space to fire your blaster\n- Press C or M to dash\n- Press Up or W when in the air to Double Jump\n- Press P to toggle low-lag mode\n\n- Mobile supported as well\n\n★★★★★★★★★★★★★★★★★★★★★★\n\nThis is a test project showcasing my version of the game engine from the SNES game, Mega Man X. It retains all features from the original, except with the Wall jump being replaced with a Double jump, along with many graphical enhancements.\n\nThere is no complete objective to this game. You can explore the level and make your way to the end and defeat the boss, so far, that is it.\n\n\n\n★★★★★★★★★CREDITS★★★★★★★★★\n\n-All sprites and all sound effects belong to Capcom,    the original creator of Mega Man. \n\n- Credit to Spriters Resource and Sprites Inc for additional sprites\n\n- Huge credit to LuckasOliver for player sprites\n\n- Music is from Mega Man X5 and Mega Man X Corrupted

@Stage\n\nwhen flag clicked\nset [checkpoint # v] to [0]\nset [music v] to [3]\nrepeat (5)\n    set [scroll x min v] to [0]\n    set [scroll x max v] to [3450]\n    set [scroll y max v] to [0]\n    set [scroll y min v] to [0]\nend\nforever\n    play sound (Music) until done\nend\n\nwhen I receive [teleportin v]\nset [music v] to [1]\nset volume to (0) %\nstop all sounds\nrepeat (10)\n    change volume by (10)\nend\nwait (3) seconds\nwait until <(Scroll X) > [3440]>\nif <(Boss Defeated?) = [0]> then\n    set [checkpoint # v] to [1]\n    set [scroll x min v] to [3450]\n    broadcast (Boss Intro v)\nend\n\nwhen I receive [teleportin v]\nset [scroll y min v] to [0]\nset [scroll x min v] to [0]\nset [scroll y max v] to [5000]\nif <<(Checkpoint #) = [1]> and <(Boss Defeated?) = [0]>> then\n    set [scroll x v] to [3400]\n    set [scroll y v] to [280]\n    set [scroll y min v] to [280]\nelse\n    set [scroll x v] to [0]\n    set [scroll y v] to [0]\nend\nwait (3) seconds\nset [scroll y min v] to [0]\n\nwhen I receive [boss intro v]\nrepeat (10)\n    change volume by (-10)\nend\nset [music v] to [2]\nset volume to (0) %\nstop all sounds\nrepeat (10)\n    change volume by (10)\nend\n\nwhen I receive [die v]\nrepeat (10)\n    change volume by (-10)\n    set [scroll y v] to [0]\nend\n\nset [checkpoint # v] to [1]\nbroadcast (die v)\n\nwhen I receive [bossdie v]\nrepeat (20)\n    change volume by (-5)\nend\n\nwhen I receive [resume stage music v]\nset [music v] to [1]\nset volume to (0) %\nstop all sounds\nrepeat (20)\n    change volume by (5)\nend\nwait (3) seconds\nset [scroll y min v] to [0]\n\nwhen I receive [start v]\nrepeat (10)\n    change volume by (-10)\nend\n\n@hitbox\n\nwhen flag clicked\nforever\n\nwhen I receive [teleportin v]\nset [falling? v] to [0]\nforever\n    wait until <(falling?) > [3]>\n    wait until <(falling?) < [2]>\n    start sound [Mega Man 5 SFX \(5\) v]\nend\n\nwhen I receive [take dmg v]\nstart sound [MMX08 v]\nbroadcast (KNOCKBACK v)\nset [takingdmg v] to [1]\nwait (.4) seconds\nset [takingdmg v] to [0]\n\nwhen flag clicked\nset [dash_int v] to [0]\nset [sliding?2 v] to [0]\n\nwhen flag clicked\nswitch costume to (idle3 v)\n\nwhen flag clicked\nset [sliding?2 v] to [0]\n\nwhen I receive [kill v]\nset [canmove? v] to [0]\n\nwhen I receive [slide v]\nset [dash_int v] to [0]\nreset timer\nrepeat until <<(timer) > [.1]> or <<not <key (c v) pressed?>> and <not <key (m v) pressed?>>>>\n    set [dash cooldown v] to [0]\n    set [sliding?2 v] to [1]\n    start sound [MMX07 v]\n    repeat until <<(timer) > [.5]> or <<not <key (c v) pressed?>> and <not <key (m v) pressed?>>>>\n        repeat (1)\n            change [dash_int v] by (1)\n            if <(direction) = [90]> then\n                set [speed x v] to [10]\n            else\n                set [speed x v] to [-10]\n            end\n        end\n    end\nend\nset [dash_int v] to [0]\nset [sliding?2 v] to [0]\nwait (.25) seconds\nset [dash cooldown v] to [1]\n\nwhen I receive [die v]\nset [canmove? v] to [0]\n\nwhen I receive [die v]\nrepeat (10)\n    set [canmove? v] to [0]\nend\n\nwhen I receive [bossdie v]\n\nset [canmove? v] to [0]\n\nwhen I receive [bossdie v]\nrepeat (50)\n    set [canmove? v] to [0]\nend\n\nwhen I receive [stuncheck v]\nif <(falling?) < [2]> then\n    broadcast (STUNNED v)\nend\n\nwhen I receive [stunned v]\nset [canmove? v] to [0]\nwait (2) seconds\nset [canmove? v] to [1]\n\nwhen I receive [hitboxsnap v]\nrepeat (3)\n    go to (player v)\n    change y by (10)\nend\n\ndefine Tick <<> <^> <>>\nif <(CanMove?) = [1]> then\n    if <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse y) > (y position)>>>> then\n        if <(Collide with ladder) = [0]> then\n            if <(Collide with ladder) = [0]> then\n                if <(dash_int) < [2]> then\n                    change [speed y v] by (-.5)\n                    change y by (speed y)\n                end\n            end\n        end\n    else\n        if <(Collide with ladder) = [0]> then\n            if <(Collide with ladder) = [0]> then\n                if <(dash_int) < [2]> then\n                    change [speed y v] by (-.5)\n                    change y by (speed y)\n                end\n            end\n        end\n    end\n    Touch Ground <(speed y) > [0]>\n    if <<key (c v) pressed?> or <key (m v) pressed?>> then\n        if <(dash cooldown) = [1]> then\n            if <(takingdmg) = [0]> then\n                broadcast (slide v)\n            end\n        end\n    end\n    if <(Walljump) > [0]> then\n        change [walljump v] by (-1)\n    end\n    if <<> then\n        if <(takingdmg) = [0]> then\n            point in direction (-90)\n            change [speed x v] by (-4)\n        end\n    end\n    if <>> then\n        if <(takingdmg) = [0]> then\n            point in direction (90)\n            change [speed x v] by (4)\n        end\n    end\n    if <<<(Halt_Animations) = [1]> and <not <(falling?) > [3]>>> or <<<key (left arrow v) pressed?> and <key (right arrow v) pressed?>> or <<key (a v) pressed?> and <key (d v) pressed?>>>> then\n        set [speed x v] to [0]\n    end\n    if <<not <<>> and <not <>>>> then\n        set [speed x v] to ((speed x) * (0))\n    end\n    set [speed x v] to ((speed x) * (.65))\n    if <(Collide with ladder) = [1]> then\n    Walk (direction) (speed x)\n    Touch Ground <(speed y) > [0]>\n    if <<<key (s v) pressed?> or <key (down arrow v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse y) < (y position)>>>> then\n    end\n    if <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse y) > (y position)>>>> then\n        if <<(falling?) < [3]> or <(Jump_counter) = [1]>> then\n            if <(Halt_Animations) = [0]> then\n                if <(takingdmg) = [0]> then\n                    set [speed y v] to [8]\n                    set [jump_counter v] to [1]\n                    change y by (3)\n                end\n            end\n        end\n    else\n        if <(dash_int) < [2]> then\n            change [speed y v] by (-.7)\n        end\n    end\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (ground v)?>>>\n    change [slope v] by (1)\n    change y by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\nend\n\nwhen flag clicked\nswitch costume to (idle v)\nset size to (200) %\nset size to (100) %\nset [falling v] to [0]\nset [speed y v] to [0]\nset [canmove? v] to [0]\nset [dead: v] to [0]\nset [health v] to [1]\ngo to x: (0) y: (-120)\nhide\nforever\n    if <(CanMove?) = [1]> then\n        Tick <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse x) < (x position)>>>> <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(y position) < (mouse y)>>>> <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(x position) < (mouse x)>>>>\n    end\nend\n\nwhen flag clicked\nset volume to (60) %\nset [canmove? v] to [0]\nset [frame v] to [0]\n\nwhen flag clicked\nset rotation style [left-right v]\nset [speed v] to [3]\n\nwhen flag clicked\nset size to (200) %\nset [speed v] to [1]\nforever\n    if <key (left arrow v) pressed?> then\n        set [speed v] to [-3]\n    end\n    if <key (right arrow v) pressed?> then\n        set [speed v] to [-3]\n    end\nend\n\nwhen I receive [die v]\nset [speed v] to [1]\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (ground v)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [speed y v] to [0]\nend\n\nwhen I receive [die v]\nset [canmove? v] to [-1]\n\nwhen I receive [knockback v]\nset [knock v] to [15]\nif <(direction) = [90]> then\n    repeat (6)\n        change [knock v] by (-2.5)\n        Walk [90] ((knock) * (-1))\n    end\nelse\n    repeat (6)\n        change [knock v] by (-2.5)\n        Walk [-90] (knock)\n    end\nend\n\ndefine Scrolling Blocks\nchange [scroll x v] by (x position)\nif <(Scroll X) < (Scroll X Min)> then\n    set [scroll x v] to (Scroll X Min)\nelse\n    if <(Scroll X) > (Scroll X Max)> then\n        set [scroll x v] to (Scroll X Max)\n    else\n        set x to (0)\n    end\nend\nchange [scroll y v] by (y position)\nif <(Scroll Y) < (Scroll Y Min)> then\n    set [scroll y v] to (Scroll Y Min)\nelse\n    if <(Scroll Y) > (Scroll Y Max)> then\n        set [scroll y v] to (Scroll Y Max)\n    else\n        set y to (0)\n    end\nend\n\nwhen I receive [teleportin v]\nset [a v] to [0]\nhide\nwait (.1) seconds\nset [scroll y v] to [0]\nset [speed y v] to [1]\nset [canmove? v] to [0]\ngo to [front v] layer\ngo to x: (0) y: (150)\nchange y by (300)\nwait (1) seconds\nset [ghost v] effect to (100)\nshow\nrepeat (8)\n    change y by (-20)\nend\nrepeat until <touching (ground v)?>\n    change y by (-20)\nend\nset x to (0)\nchange y by (15)\n\nwhen flag clicked\nset [checkpoint # v] to [0]\nset [fightstart? v] to [0]\n\nwhen I receive [battle begin v]\nset [canmove? v] to [0]\nwait (2) seconds\nset [canmove? v] to [1]\n\nwhen I receive [ready v]\nset [canmove? v] to [0]\nhide\n\nwhen I receive [bossdie v]\nset [canmove? v] to [0]\n\nwhen I receive [enable movement v]\nset [canmove? v] to [1]\n\nwhen flag clicked\nforever\n    set [ghost v] effect to (99)\n    show\nend\n\nwhen flag clicked\nforever\n    if <(falling?) < [3]> then\n        set [jump_counter v] to [0]\n    end\nend\n\nwhen I receive [teleportin v]\nforever\n    wait (1) seconds\n    wait until <(y position) < [-180]>\n    set [health v] to [28]\n    set [sliding?2 v] to [0]\nend\n\nwhen I receive [disable movement v]\nset [canmove? v] to [0]\n\nwhen I receive [megaman move w/ platform v]\nWalk (direction) [5]\n\nset [canmove? v] to [1]\nset [canmove? v] to [1]\n\nwhen I receive [teleportin v]\nset [dash cooldown v] to [1]\n\nwhen flag clicked\nset [double jump enabled? v] to [1]\n\nwhen I receive [teleportin v]\nforever\n    set [jump_counter v] to [0]\n    wait until <(falling?) > [3]>\n    wait until <not <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse y) > (y position)>>>>>\n    set [jump_counter v] to [1]\n    wait until <<(falling?) < [4]> or <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse y) > (y position)>>>>>\n    if <(falling?) < [4]> then\n        set [jump_counter v] to [0]\n    else\n        set [jump_counter v] to [0]\n        broadcast (Double Jump v)\n        wait until <(falling?) > [15]>\n        set [jump_counter v] to [0]\n    end\n    wait until <not <(falling?) > [3]>>\nend\n\nwhen I receive [teleportin v]\nforever\n    wait until <(falling?) < [3]>\n    start sound [MMX05 v]\n    set [walljump v] to [0]\n    wait until <(falling?) > [3]>\n    start sound [MMX05 v]\nend\n\nwhen flag clicked\nset [dash_int v] to [0]\n\nif <<key (up arrow v) pressed?> and <([abs v] of (speed) ) > [6]>> then\n    if <(Walljump) = [0]> then\n        set [walljump v] to [15]\n        set [speed x v] to ((speed) * (-10))\n        set [speed y v] to <[] > [50]>\n        change y by (4)\n    end\nend\n\nwhen flag clicked\nforever\n    Scrolling Blocks\nend\n\n@Player\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\nwhen flag clicked\nset [health v] to [1]\nset [health v] to [1]\n\nwhen I receive [die v]\nset [speed v] to [1]\nset [canmove? v] to [0]\nstop [other scripts in sprite v]\nrepeat (2)\n    switch costume to (xouch1 v)\n    wait (.05) seconds\n    next costume\n    wait (.05) seconds\nend\nhide\nbroadcast (death animation v)\nrepeat (10)\n    set [getting ouched ? v] to [0]\nend\n\nwhen flag clicked\nset [megaman costume v] to [1]\nset rotation style [left-right v]\nset [speed v] to [3]\n\nwhen flag clicked\nforever\n    if <<key (space v) pressed?> or <mouse down?>> then\n        set [animations: using gun?2 v] to [1]\n    else\n        set [animations: using gun?2 v] to [0]\n    end\nend\n\ndefine Do (what?)\nif <<<(CanMove?) = [1]> and <(Dashing?) = [0]>> and <(Halt_Animations) = [0]>> then\n    if <(what?) = [Walk]> then\n        if <not <(dead:) = [1]>> then\n            set [mmx runcycle v] to [0]\n            repeat until <<<(Halt_Animations) = [1]> or <([falling? v] of [hitbox v]) > [3]>> or <<not <<(Dashing?) = [0]> and <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(x position) < (mouse x)>>>> or <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse x) < (x position)>>>>>>> or <(MMX RUNCYCLE) > [9]>>>\n                if <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(x position) < (mouse x)>>>> or <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse x) < (x position)>>>>> then\n                    change [mmx runcycle v] by (1)\n                    if <(animations: using gun?2) = [1]> then\n                        if <(Dashing?) = [0]> then\n                            switch costume to (join [gunruncycle] (MMX RUNCYCLE))\n                        end\n                    else\n                        if <(Dashing?) = [0]> then\n                            switch costume to (join [runcycle] (MMX RUNCYCLE))\n                        end\n                    end\n                    wait (0) seconds\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nif <not <(HEALTH) > [14]>> then\n    move (20) steps\n    repeat until <<(x position) < [-230]> or <(x position) > [230]>>\n        move (20) steps\n    end\n    delete this clone\nend\nif <(HEALTH) > [14]> then\n    set size to (100) %\n    repeat until <touching (_edge_ v)?>\n        move (10) steps\n    end\n    delete this clone\nend\n\ndefine death\n\nwhen I start as a clone\nforever\n    show\nend\n\nwhen flag clicked\nset volume to (100) %\nswitch costume to (idle v)\nset size to (200) %\nclear graphic effects\nset [falling v] to [0]\nset [speed y v] to [0]\nset [holding? v] to [0]\nset [dead: v] to [0]\nset [health v] to [1]\ngo to x: (0) y: (-120)\npoint in direction (90)\nset volume to (100) %\n\nwhen I receive [die v]\nset [canmove? v] to [0]\nhide\nbroadcast (X- death effect v)\nwait (1) seconds\n\nwhen I receive [take dmg v]\nstart sound [Mega Man 5 SFX \(6\) v]\nset [takingdmg v] to [1]\nset [canmove? v] to [0]\nset [getting ouched ? v] to [1]\nrepeat (4)\n    set [ghost v] effect to (100)\n    wait (.05) seconds\n    set [ghost v] effect to (0)\n    wait (.05) seconds\nend\nset [getting ouched ? v] to [0]\nset [canmove? v] to [1]\nset [takingdmg v] to [0]\nrepeat (4)\n    set [ghost v] effect to (100)\n    wait (.05) seconds\n    set [ghost v] effect to (0)\n    wait (.05) seconds\nend\n\nwhen flag clicked\nset [getting ouched ? v] to [0]\nset [takingdmg v] to [0]\n\nwhen I receive [blink v]\nif <(clone?) = [0]> then\n    repeat (3)\n        set [ghost v] effect to (100)\n        wait (.05) seconds\n        set [ghost v] effect to (0)\n        wait (.05) seconds\n    end\nend\n\nwhen I receive [teleportin v]\nif <(clone?) = [0]> then\n    hide\n    set [canmove? v] to [-1]\n    go to [front v] layer\n    switch costume to (1x v)\n    wait (1.5) seconds\n    go to x: (0) y: (899)\n    show\n    repeat (5)\n        switch costume to (1x v)\n        change y by (-35)\n    end\n    repeat until <touching (ground v)?>\n        change y by (-35)\n    end\n    switch costume to (2x v)\n    start sound [MMX04 v]\n    repeat (9)\n        wait (.02) seconds\n        next costume\n    end\nend\nwait (.1) seconds\nbroadcast (Enable Movement v)\nset [canmove? v] to [1]\n\nwhen flag clicked\nhide\n\nwhen I receive [teleportin v]\nclear graphic effects\n\nwhen I receive [bossdie v]\nset [canmove? v] to [-1]\nchange y by (-3)\nif <([falling? v] of [hitbox v]) < [3]> then\n    repeat (10)\n        if <(Megaman Costume) = [1]> then\n            switch costume to (idle v)\n        else\n            switch costume to (join [idle] (Megaman Costume))\n        end\n    end\nelse\n    repeat (10)\n        if <(Megaman Costume) = [1]> then\n            switch costume to (jump v)\n        else\n            switch costume to (join [jump] (Megaman Costume))\n        end\n    end\nend\nrepeat until <touching (ground v)?>\n    change y by (-8)\nend\nchange y by (-6)\nif <(Megaman Costume) = [1]> then\n    switch costume to (idle v)\nelse\n    switch costume to (join [idle] (Megaman Costume))\nend\n\nwhen I start as a clone\nclear graphic effects\n\nwhen I receive [teleportin v]\nrepeat (10)\n    clear graphic effects\nend\n\nwhen I receive [battle begin v]\nset [canmove? v] to [1]\nset rotation style [left-right v]\n\nwhen I start as a clone\ngo to [front v] layer\n\nwhen I start as a clone\nif <(HEALTH) > [14]> then\n    forever\n        switch costume to (death v)\n    end\nend\n\nwhen I start as a clone\nset [clone? v] to [1]\n\nwhen I receive [die v]\nset [health v] to [15]\n\nwhen I start as a clone\nset [clone v] to [1]\n\nwhen I receive [die v]\nset [canmove? v] to [0]\n\nwhen I receive [die v]\nrepeat (15)\n    set [canmove? v] to [0]\nend\n\nwhen I receive [bossdie v]\nset [canmove? v] to [0]\n\nwhen I receive [bossdie v]\ndelete this clone\n\nwhen I receive [teleportin v]\nset size to (200) %\nset [speed v] to [1]\nforever\n    if <(CanMove?) = [1]> then\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse x) < (x position)>>>> then\n            point in direction (-90)\n            set [speed v] to [-4]\n        end\n        if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(x position) < (mouse x)>>>> then\n            point in direction (90)\n            set [speed v] to [-4]\n        end\n    end\nend\n\nwhen I receive [teleportin v]\nforever\n    if <<not <(HEALTH) > [27]>> and <not <(CanMove?) = [-1]>>> then\n        go to x: ([x position v] of [hitbox v]) y: (([y position v] of [hitbox v]) + (-28))\n    end\nend\n\nwhen I receive [stunned v]\nset [canmove? v] to [-1]\nrepeat (10)\n    change x by (5)\n    wait (0) seconds\n    repeat (2)\n        change x by (-5)\n        wait (0) seconds\n    end\n    change x by (5)\n    wait (0) seconds\nend\nset [canmove? v] to [1]\n\nwhen I receive [battle begin v]\nset [canmove? v] to [0]\nwait (2.2) seconds\nset [canmove? v] to [1]\n\nwhen I receive [ready v]\nset [canmove? v] to [0]\nhide\n\nwhen I receive [back to select v]\nswitch costume to (break2 v)\nrepeat until <(y position) > [178]>\n    set [canmove? v] to [-1]\n    change y by (20)\nend\nhide\n\nwhen I receive [teleportin v]\ndelete this clone\n\nwhen I receive [take dmg v]\nrepeat (45)\n    set [invincibility v] to [1]\nend\nset [invincibility v] to [0]\n\nwhen I receive [enable movement v]\nset [canmove? v] to [1]\n\nwhen I receive [teleportin v]\nforever\n    set [universal hold v] to (hold)\nend\n\nwhen I start as a clone\nwait until <touching (boss v)?>\nif <not <(HEALTH) > [14]>> then\n    wait (.05) seconds\n    delete this clone\nend\n\nwhen I receive [disable movement v]\nset [canmove? v] to [0]\n\nwhen I receive [teleportin v]\nset size to (200) %\n\nwhen I receive [teleportin v]\ngo to [front v] layer\n\nwhen I receive [teleportin v]\nset [halt_animations v] to [0]\nset rotation style [left-right v]\nforever\n    if <(Halt_Animations) = [0]> then\n        if <(getting ouched ?) = [1]> then\n            switch costume to (xouch1 v)\n            wait (.05) seconds\n            switch costume to (xouch2 v)\n            wait (.05) seconds\n        else\n            if <(Dashing?) = [1]> then\n                if <(animations: using gun?2) = [0]> then\n                    if <(dash_int) > [5]> then\n                        switch costume to (xdash3 v)\n                    else\n                        if <(dash_int) > [2]> then\n                            switch costume to (xdash2 v)\n                        else\n                            switch costume to (xdash1 v)\n                        end\n                    end\n                else\n                    if <(dash_int) > [5]> then\n                        switch costume to (xgundash3 v)\n                    else\n                        if <(dash_int) > [2]> then\n                            switch costume to (xgundash2 v)\n                        else\n                            switch costume to (xgundash1 v)\n                        end\n                    end\n                end\n            else\n                if <(CanMove?) = [1]> then\n                    if <([falling? v] of [hitbox v]) > [3]> then\n                        if <(Dashing?) = [0]> then\n                            if <(Walljump) > [5]> then\n                                if <(Walljump) > [10]> then\n                                    switch costume to (xwallkick1 v)\n                                else\n                                    switch costume to (xwallkick2 v)\n                                end\n                            else\n                                if <([falling? v] of [hitbox v]) > [40]> then\n                                    if <(animations: using gun?2) = [0]> then\n                                        switch costume to (xjump6 v)\n                                    else\n                                        switch costume to (xgunjump7 v)\n                                    end\n                                else\n                                    if <([falling? v] of [hitbox v]) > [35]> then\n                                        if <(animations: using gun?2) = [0]> then\n                                            switch costume to (xjump5 v)\n                                        else\n                                            switch costume to (xgunjump6 v)\n                                        end\n                                    else\n                                        if <([falling? v] of [hitbox v]) > [25]> then\n                                            if <(animations: using gun?2) = [0]> then\n                                                switch costume to (xjump4 v)\n                                            else\n                                                switch costume to (xgunjump5 v)\n                                            end\n                                        else\n                                            if <([falling? v] of [hitbox v]) > [10]> then\n                                                if <(animations: using gun?2) = [0]> then\n                                                    switch costume to (xjump3 v)\n                                                else\n                                                    switch costume to (xgunjump3 v)\n                                                end\n                                            else\n                                                if <([falling? v] of [hitbox v]) > [5]> then\n                                                    if <(animations: using gun?2) = [0]> then\n                                                        switch costume to (xjump2 v)\n                                                    else\n                                                        switch costume to (xgunjump2 v)\n                                                    end\n                                                else\n                                                    if <(animations: using gun?2) = [0]> then\n                                                        switch costume to (xjump1 v)\n                                                    else\n                                                        switch costume to (xgunjump1 v)\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    else\n                        if <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(x position) < (mouse x)>>>> or <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse x) < (x position)>>>>> then\n                            if <(Dashing?) = [0]> then\n                                Do [Walk]\n                            end\n                        else\n                            if <<not <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(x position) < (mouse x)>>>> or <<<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse x) < (x position)>>>> or <key (up arrow v) pressed?>>>> and <(Holding?) = [0]>> then\n                                if <(animations: using gun?2) = [1]> then\n                                    if <(Dashing?) = [0]> then\n                                        switch costume to (xfire1 v)\n                                        if <(hold) < [5]> then\n                                            if <not <([falling? v] of [hitbox v]) > [1]>> then\n                                                repeat (3)\n                                                    wait (.05) seconds\n                                                    next costume\n                                                end\n                                            end\n                                        end\n                                    end\n                                else\n                                    if <(Dashing?) = [0]> then\n                                        switch costume to (IDLE_TICK)\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [teleportin v]\nset [dashing? v] to [0]\nforever\n    if <<(CanMove?) = [1]> and <<key (space v) pressed?> or <mouse down?>>> then\n        set [hold v] to [0]\n        create clone of (x buster v)\n        repeat until <<(hold) > [39]> or <<not <key (space v) pressed?>> and <not <mouse down?>>>>\n            change [hold v] by (1)\n        end\n        if <(hold) > [39]> then\n            repeat until <<not <key (space v) pressed?>> and <not <mouse down?>>>\n                start sound [MMX02A v]\n                set [brightness v] effect to (80)\n                wait (.1) seconds\n                set [brightness v] effect to (0)\n                wait (.1) seconds\n            end\n            set [hold v] to [60]\n            if <not <(HEALTH) > [14]>> then\n                if <(CanMove?) = [1]> then\n                    create clone of (x buster v)\n                    start sound [MMX01 v]\n                end\n            end\n            ChargeShot Animation\n        else\n            wait until <<not <key (space v) pressed?>> and <not <mouse down?>>>\n        end\n        set [hold v] to [0]\n    end\nend\n\nwhen I receive [teleportin v]\nforever\n    set [dashing? v] to ([sliding?2 v] of [hitbox v])\nend\n\nwhen I receive [teleportin v]\nforever\n    if <<key (space v) pressed?> or <mouse down?>> then\n        set [animations: using gun?2 v] to [1]\n    else\n        set [animations: using gun?2 v] to [0]\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\n\nwhen I receive [teleportin v]\nforever\n    if <<<<key (s v) pressed?> or <key (down arrow v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse y) < (y position)>>>> or <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <<(distance to [mouse-pointer v]) > [20]> and <(mouse y) > (y position)>>>>> then\n        if <(Ladder Climb Alternate) = [2]> then\n            set [ladder climb alternate v] to [1]\n        else\n            set [ladder climb alternate v] to [2]\n        end\n        wait (.1) seconds\n    end\nend\n\nwhen I receive [teleportin v]\nforever\n    set [idle_tick v] to [1]\n    repeat (15)\n        change [idle_tick v] by (1)\n        wait (.0) seconds\n    end\nend\n\ndefine ChargeShot Animation\nrepeat (1)\n    set [halt_animations v] to [1]\n    switch costume to (xfire6 v)\nend\nrepeat (5)\n    wait (.0) seconds\n    next costume\nend\nset [halt_animations v] to [0]\n\n@ground\n\nwhen I receive [setup v]\nhide\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nCreate\n\ndefine Create\nset [scroll x v] to [0]\nset [level_y v] to [0]\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nset size to (200) %\nrepeat (11)\n    create clone of (_myself_ v)\n    next costume\n    change [level_x v] by (510)\nend\nset [level_y v] to [250]\nset [level_x v] to [0]\nswitch costume to (costume8 v)\nset size to (200) %\nrepeat (3)\n    create clone of (_myself_ v)\n    next costume\n    change [level_x v] by (510)\nend\n\nwhen flag clicked\ngo to [front v] layer\nset [scroll x min v] to [0]\nhide\nbroadcast (SetUp v)\nset [scroll y v] to [0]\n\nbroadcast (Teleportin v)\n\nwhen I start as a clone\nforever\n    set [ghost v] effect to (0)\n    set x to ((Level_X) - (Scroll X))\n    set y to ((Level_Y) - (Scroll Y))\n    if <<([abs v] of ((Level_X) - (Scroll X)) ) > [550]> or <([abs v] of ((Level_Y) - (Scroll Y)) ) > [420]>> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\ndelete this clone\n\n@X Buster\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nclear graphic effects\ngo to [front v] layer\nshow\nif <(Universal Hold) > [38]> then\n    point in direction ([direction v] of [player v])\n    show\n    start sound [MMX03 v]\n    set [lvlx v] to ((Scroll X) + ([x position v] of [player v]))\n    set [lvl_y v] to ((Scroll Y) + ([y position v] of [player v]))\n    go to [front v] layer\n    change [lvlx v] by (([sin v] of (direction) ) * (25))\n    if <(dash_int) > [0]> then\n        change [lvlx v] by (([sin v] of (direction) ) * (25))\n        change [lvl_y v] by (-3)\n    else\n        change [lvl_y v] by (7)\n    end\n    repeat until <touching (_edge_ v)?>\n        change [lvlx v] by (([sin v] of (direction) ) * (25))\n    end\n    delete this clone\nelse\n    switch costume to (costume2 v)\n    point in direction ([direction v] of [player v])\n    show\n    start sound [MMX00 v]\n    set [lvlx v] to ((Scroll X) + ([x position v] of [player v]))\n    set [lvl_y v] to ((Scroll Y) + ([y position v] of [player v]))\n    go to [front v] layer\n    change [lvlx v] by (([sin v] of (direction) ) * (25))\n    if <(dash_int) > [0]> then\n        change [lvlx v] by (([sin v] of (direction) ) * (25))\n        change [lvl_y v] by (-3)\n    else\n        change [lvl_y v] by (7)\n    end\n    wait (.05) seconds\n    go [forward v] (1) layers\n    next costume\n    show\n    wait (.05) seconds\n    switch costume to (costume1 v)\n    repeat until <touching (_edge_ v)?>\n        change [lvlx v] by (([sin v] of (direction) ) * (25))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nforever\n    go to x: ((lvlX) - (Scroll X)) y: ((lvl_y) - (Scroll Y))\nend\n\nwhen I start as a clone\nwait until <touching (boss v)?>\nstop [other scripts in sprite v]\nswitch costume to (costume2 v)\nrepeat (1)\n    go to x: ((lvlX) - (Scroll X)) y: ((lvl_y) - (Scroll Y))\nend\nswitch costume to (costume3 v)\nrepeat (1)\n    go to x: ((lvlX) - (Scroll X)) y: ((lvl_y) - (Scroll Y))\nend\ndelete this clone\n\nwhen I start as a clone\nif <(Universal Hold) > [38]> then\n    forever\n        switch costume to (costume4 v)\n        wait (.02) seconds\n        next costume\n        wait (.02) seconds\n    end\nend\n\n@Blur Effect\n\nwhen flag clicked\nset [blur effect v] to [1]\nhide\nforever\n    if <([canmove? v] of [hitbox v]) = [1]> then\n        switch costume to ([costume name v] of [player v])\n        if <(Blur Effect) = [1]> then\n            create clone of (_myself_ v)\n        end\n    end\nend\n\nwhen I start as a clone\ngo to [front v] layer\ngo [backward v] (30) layers\npoint in direction ([direction v] of [player v])\ngo to (player v)\nset [ghost v] effect to (50)\nshow\nrepeat (5)\n    change x by (([speed x v] of [hitbox v]) * (-1))\n    change y by (([speed y v] of [hitbox v]) * (-1))\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwait (.02) seconds\n\nwhen flag clicked\nforever\n    wait until <key (p v) pressed?>\n    set [blur effect v] to [0]\n    wait until <not <key (p v) pressed?>>\n    wait until <key (p v) pressed?>\n    set [blur effect v] to [1]\n    wait until <not <key (p v) pressed?>>\nend\n\n@Parallax\n\nwhen I receive [setup v]\nif <[1] = [1]> then\n    delete this clone\nend\nhide\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nCreate\n\ndefine Create\nswitch costume to (costume1 v)\nset size to (200) %\nset [level_y v] to [0]\nset [level_x v] to [0]\nrepeat (8)\n    create clone of (_myself_ v)\n    change [level_x v] by (510)\n    next costume\nend\n\nwhen I start as a clone\ngo to [front v] layer\nforever\n    set x to (((Level_X) - (Scroll X)) + (([x position v] of [player v]) / (-25)))\n    set y to ((Scroll Y) + (([y position v] of [player v]) / (-25)))\n    if <<([abs v] of ((Level_X) - (Scroll X)) ) > [490]> or <([abs v] of ((Level_Y) - (Scroll Y)) ) > [400]>> then\n        hide\n    else\n        show\n    end\nend\n\nwhen flag clicked\nhide\n\n@background effects\n\nwhen flag clicked\ngo to [front v] layer\ngo [backward v] (15) layers\nhide\nforever\n    create clone of (_myself_ v)\n    wait (.1) seconds\nend\n\nwhen I start as a clone\nset [lvlx v] to ((Scroll X) + (500))\nset size to (pick random (50) to (200)) %\nset [lvl_y v] to (((size) * (-1)) + (50))\nset [brightness v] effect to (([abs v] of ((size) + (-250)) ) * (-.2))\ngo [backward v] (([abs v] of ((size) + (-250)) ) * (.1)) layers\nshow\nrepeat (270)\n    change [lvlx v] by (-3)\nend\ndelete this clone\n\nwhen I start as a clone\nforever\n    go to x: ((lvlX) - (Scroll X)) y: ((lvl_y) - ((Scroll Y) / (10)))\n    if <([abs v] of (x position) ) > (((size) * (1.5)) + (120))> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I start as a clone\nwait (pick random (.5) to (15)) seconds\nrepeat (2)\n    change [brightness v] effect by (25)\nend\nrepeat (2)\n    change [brightness v] effect by (-25)\nend\n\nwhen I start as a clone\nwait until <(Blur Effect) = [0]>\ndelete this clone\n\n@rain that nobody asked for\n\nwhen I start as a clone\nwait (.03) seconds\nforever\n    go to x: ((lvlX) - (Scroll X)) y: ((lvl_y) - (Scroll Y))\n    if <<([abs v] of (x position) ) > [200]> or <([abs v] of (y position) ) > [170]>> then\n        hide\n    else\n        show\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\ngo [backward v] (15) layers\nhide\nforever\n    create clone of (_myself_ v)\n    wait (.02) seconds\nend\n\nwhen I start as a clone\nset [lvlx v] to ((Scroll X) + (pick random (-250) to (350)))\nset size to (pick random (50) to (200)) %\nset [lvl_y v] to [500]\nrepeat (50)\n    change [lvlx v] by (-10)\n    change [lvl_y v] by (-20)\nend\ndelete this clone\n\nwhen I start as a clone\nwait until <(Blur Effect) = [0]>\ndelete this clone\n\n@border\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    go to [front v] layer\nend\n\n@hpbar\n\nwhen flag clicked\ngo to [front v] layer\nhide\nwait (1) seconds\nrepeat (10)\n    set [health v] to [1]\nend\nforever\n    wait until <(HEALTH) > [27]>\n    broadcast (die v)\n    wait (5) seconds\n    set [health v] to [1]\n    wait (.05) seconds\nend\n\nwhen I receive [take dmg v]\nif <(INVINCIBILITY) = [0]> then\n    set [brightness v] effect to (60)\n    wait (.2) seconds\nend\nclear graphic effects\nwait (.2) seconds\n\nwhen I receive [teleportin v]\nset [health v] to [1]\npoint in direction (90)\ngo to x: (-125) y: (132)\nset size to (200) %\nclear graphic effects\nshow\nforever\n    go to [front v] layer\n    switch costume to (HEALTH)\nend\n\nwhen I receive [bossdie v]\nhide\ndelete this clone\n\nwhen I receive [die v]\nhide\nwait (6) seconds\nset [health v] to [1]\n\nwhen I receive [die v]\ndelete this clone\n\nwhen I receive [teleportin v]\ngo to [front v] layer\nset [invincibility v] to [0]\n\nwhen I receive [take dmg v]\nset [invincibility v] to [1]\nwait (.8) seconds\nset [invincibility v] to [0]\n\nwhen I receive [battle begin v]\ngo to [front v] layer\n\nwhen I receive [teleportin v]\nrepeat (10)\n    set [health v] to [1]\nend\nshow\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n@light\n\nwhen flag clicked\nshow\nforever\n    if <([canmove? v] of [hitbox v]) = [1]> then\n        show\n    else\n        hide\n    end\n    switch costume to (costume1 v)\n    go to [front v] layer\n    go [backward v] (35) layers\n    set [ghost v] effect to (15)\n    go to (player v)\nend\n\nwhen flag clicked\nforever\n    if <(Universal Hold) > [30]> then\n        if <<key (space v) pressed?> or <mouse down?>> then\n            create clone of (_myself_ v)\n            wait (.1) seconds\n        end\n    end\nend\n\nwhen I start as a clone\ngo to [front v] layer\nswitch costume to (costume2 v)\nset [ghost v] effect to (15)\nset [y v] to [0]\nchange y by (-40)\nchange x by (pick random (-30) to (30))\nrepeat (15)\n    change [ghost v] effect by (4)\n    change [y v] by (2)\n    change y by (y)\nend\ndelete this clone\n\n@Doublejump\n\nwhen I start as a clone\nset [clone v] to [1]\ngo to [front v] layer\nset [ghost v] effect to (0)\nshow\nrepeat (10)\n    next costume\n    change x by (([speed x v] of [hitbox v]) * (-1))\n    change y by (([speed y v] of [hitbox v]) * (-1))\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen flag clicked\nset [clone v] to [0]\nhide\n\nwhen I receive [double jump v]\nif <(clone) = [0]> then\n    start sound [MMX9E v]\n    go to (player v)\n    change y by (-30)\n    change x by (-15)\n    create clone of (_myself_ v)\n    go to (player v)\n    change y by (-30)\n    change x by (15)\n    create clone of (_myself_ v)\nend\n\n@x death\n\nwhen flag clicked\nset size to (200) %\nhide\n\nwhen I receive [death animation v]\ngo to [front v] layer\ngo to (player v)\nset rotation style [left-right v]\npoint in direction (0)\nstart sound [MMX09 v]\nrepeat (15)\n    create clone of (_myself_ v)\n    turn right (35) degrees\nend\nwait (1) seconds\nbroadcast (Teleportin v)\n\nwhen I start as a clone\nswitch costume to (death1 v)\nshow\nrepeat (3)\n    wait (.5) seconds\n    next costume\nend\nwait (.5) seconds\ndelete this clone\n\nwhen I start as a clone\nset [z v] to [0]\nforever\n    move (z) steps\n    turn right (15) degrees\n    change [z v] by (1)\nend\n\n@Boss\n\nwhen flag clicked\nset rotation style [left-right v]\nhide\n\nwhen I receive [death animation v]\nwait (1) seconds\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [boss intro v]\nforever\n    set y to ((Level_Y) - (Scroll Y))\nend\n\nwhen I receive [boss intro v]\nclear graphic effects\nwait (1) seconds\nbroadcast (Disable Movement v)\nwait (1) seconds\ngo to [front v] layer\nset x to (-150)\npoint in direction (-90)\nswitch costume to (robojump6 v)\nrepeat (10)\n    set [level_y v] to [500]\nend\nset [y v] to [0]\nshow\nrepeat (15)\n    change [level_y v] by (y)\n    change [y v] by (-2)\nend\nset [level_y v] to [241]\nswitch costume to (robojump4 v)\nwait (.1) seconds\nswitch costume to (robo1 v)\nwait (1) seconds\nswitch costume to (robograb1 v)\nrepeat (4)\n    wait (.1) seconds\n    next costume\nend\nrepeat (4)\n    wait (.1) seconds\n    switch costume to ((costume [number v]) + (-1))\nend\nwait (.1) seconds\nswitch costume to (robo1 v)\nbroadcast (bATTLE begin v)\n\nwhen I receive [battle begin v]\nforever\n    if <touching (x buster v)?> then\n        start sound [MMX9G v]\n        broadcast (BossDMG v)\n        set [brightness v] effect to (100)\n        wait (.1) seconds\n        set [brightness v] effect to (0)\n        wait (.1) seconds\n    end\nend\n\nwhen I receive [battle begin v]\nforever\n    if <touching (hitbox v)?> then\n        change [health v] by (6)\n        broadcast (TAKE DMG v)\n        wait (2) seconds\n    end\nend\n\nwhen I receive [battle begin v]\nwait (2) seconds\nforever\n    point towards (player v)\n    turn right (180) degrees\n    set [y v] to [25]\n    switch costume to (robojump1 v)\n    repeat (3)\n        wait (.1) seconds\n        next costume\n    end\n    repeat (10)\n        move (-5) steps\n        change [level_y v] by (y)\n        change [y v] by (-2)\n    end\n    next costume\n    repeat until <(Level_Y) < [230]>\n        move (-5) steps\n        change [level_y v] by (y)\n        change [y v] by (-2)\n    end\n    set [level_y v] to [241]\n    switch costume to (robojump4 v)\n    start sound [MMX52 v]\n    wait (.1) seconds\n    switch costume to (robo1 v)\n    point towards (player v)\n    turn right (180) degrees\n    wait (.6) seconds\n    switch costume to (robograb1 v)\n    repeat (5)\n        wait (.1) seconds\n        next costume\n    end\n    point towards (player v)\n    start sound [MMX69 v]\n    turn right (180) degrees\n    set [chain v] to [1]\n    create clone of (_myself_ v)\n    wait (0) seconds\n    repeat (15)\n        change [chain v] by (1)\n        create clone of (_myself_ v)\n        wait (0) seconds\n    end\n    repeat (1)\n        wait (.1) seconds\n        next costume\n    end\n    wait (.7) seconds\n    repeat (6)\n        wait (.1) seconds\n        switch costume to ((costume [number v]) + (-1))\n    end\n    wait (.1) seconds\n    switch costume to (robo1 v)\nend\n\nwhen I start as a clone\nif <(chain) = [1]> then\n    switch costume to (roboclaw1 v)\nelse\n    switch costume to (roboclaw2 v)\nend\ngo to [front v] layer\nchange [level_y v] by (-14)\nset [y v] to [0]\nchange x by (([sin v] of (direction) ) * (-36))\nrepeat ([abs v] of ((chain) + (-16)) )\n    change x by (([sin v] of (direction) ) * ((y) * (-1)))\n    change [level_y v] by (([cos v] of (direction) ) * ((y) * (-1)))\n    change [y v] by (3)\nend\nset [y v] to [0]\nwait (1) seconds\nrepeat ([abs v] of ((chain) + (-16)) )\n    change x by (([sin v] of (direction) ) * ((y) * (-1)))\n    change [level_y v] by (([cos v] of (direction) ) * ((y) * (-1)))\n    change [y v] by (-3)\nend\ndelete this clone\n\nwhen I start as a clone\nforever\n    clear graphic effects\n    set y to ((Level_Y) - (Scroll Y))\nend\n\nwhen I start as a clone\nif <(chain) = [1]> then\n    forever\n        if <touching (hitbox v)?> then\n            change [health v] by (2)\n            broadcast (TAKE DMG v)\n            wait (2) seconds\n        end\n    end\nend\n\nwhen I receive [bossdie v]\nstop [other scripts in sprite v]\nif <[1] = [1]> then\n    delete this clone\nend\nset [brightness v] effect to (0)\nrepeat (5)\n    go to [front v] layer\nend\nrepeat (50)\n    change [brightness v] effect by (-2)\nend\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\n\n@boss hp\n\nwhen flag clicked\nset [clone v] to [0]\nclear graphic effects\nhide\n\nwhen I receive [battle begin v]\nset [fightstart? v] to [1]\ngo to x: (135) y: (132)\npoint in direction (90)\nset size to (200) %\ngo to [front v] layer\nshow\nset [brightness v] effect to (0)\nswitch costume to (costume28 v)\nrepeat (27)\n    start sound [MMX9S v]\n    switch costume to ((costume [number v]) + (-1))\n    wait (0) seconds\nend\n\nwhen I receive [bossdmg v]\nif <(clone) = [0]> then\n    repeat (3)\n        set [brightness v] effect to (60)\n        wait (.1) seconds\n        set [brightness v] effect to (0)\n        wait (.1) seconds\n    end\nend\n\nwhen I receive [bossdmg v]\nif <(clone) = [0]> then\n    if <(BOSS_INVINCIBLE) = [0]> then\n        next costume\n        if <(Universal Hold) > [38]> then\n            next costume\n            next costume\n            next costume\n        end\n        if <(costume [number v]) > [27]> then\n            broadcast (BOSSDIE v)\n            wait (5) seconds\n        end\n    end\nend\n\nwhen I receive [bossdie v]\nhide\nswitch costume to (hpbar v)\n\nwhen I receive [die v]\nhide\n\nwhen I start as a clone\nset [clone v] to [1]\nset [ghost v] effect to (5)\nswitch costume to (dmg v)\ngo to [front v] layer\nshow\nstart sound [sfx6 v]\nrepeat (6)\n    go to (boss v)\nend\ndelete this clone\n\n@Transition Effect\n\nwhen flag clicked\nset [boss defeated? v] to [0]\nhide\n\nwhen I receive [die v]\nwait (1.6) seconds\nswitch costume to (costume1 v)\nset size to (100) %\ngo to x: (0) y: (0)\nchange [brightness v] effect by (0)\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nrepeat (25)\n    go to [front v] layer\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen I receive [bossdie v]\nswitch costume to (costume1 v)\nset size to (100) %\ngo to x: (0) y: (0)\nchange [brightness v] effect by (100)\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nwait (5) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\nbroadcast (Enable Movement v)\nbroadcast (Resume Stage Music v)\nset [scroll x min v] to [0]\n\nwhen I receive [bossdie v]\nset [z v] to [.5]\nrepeat (30)\n    create clone of (_myself_ v)\n    change [z v] by (-.05)\n    wait (z) seconds\nend\n\nwhen I start as a clone\ngo to (boss v)\nchange y by (pick random (-50) to (50))\nchange x by (pick random (-50) to (50))\nclear graphic effects\nswitch costume to (explode1 v)\nset size to (200) %\nstart sound [MMX29 v]\ngo to [front v] layer\nshow\nrepeat (6)\n    wait (.05) seconds\n    next costume\nend\nwait (.05) seconds\ndelete this clone\n\nwhen I receive [start v]\nstart sound [fanfare v]\nswitch costume to (costume1 v)\nset size to (100) %\ngo to x: (0) y: (0)\nchange [brightness v] effect by (0)\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [brightness v] effect by (10)\n    change [ghost v] effect by (-10)\nend\nrepeat (25)\n    go to [front v] layer\nend\nrepeat (10)\n    change [brightness v] effect by (-10)\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nbroadcast (Teleportin v)\nhide\n\n@toenail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nshow\nforever\n    go to [front v] layer\nend\n\n@Menu\n\nwhen flag clicked\nset [able to select? v] to [1]\nclear graphic effects\ngo to x: (0) y: (999)\nswitch costume to (mega-man-x-3 v)\nhide\nrepeat (3)\n    wait (.1) seconds\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen I start as a clone\ngo to [front v] layer\nshow\nif <(costume [number v]) = [1]> then\n    glide (.5) secs to x: (0) y: (100)\nend\nif <(costume [number v]) = [2]> then\n    glide (.5) secs to x: (0) y: (0)\nend\nif <(costume [number v]) = [3]> then\n    glide (.5) secs to x: (0) y: (-50)\nend\n\nwhen I start as a clone\nif <(costume [number v]) > [1]> then\n    forever\n        if <touching (mouse-pointer v)?> then\n            set [brightness v] effect to (40)\n        else\n            clear graphic effects\n        end\n    end\nend\n\nwhen I receive [start v]\nwait (1) seconds\ndelete this clone\n\nwhen this sprite clicked\nif <(Able to Select?) = [1]> then\n    if <(costume [number v]) = [2]> then\n        set [able to select? v] to [0]\n        broadcast (START v)\n    end\n    if <(costume [number v]) = [3]> then\n        set [able to select? v] to [0]\n        broadcast (How to Play v)\n    end\nend\n\n@how to basic\n\nwhen flag clicked\nhide\n\nwhen I receive [how to play v]\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait until <<mouse down?> or <key (space v) pressed?>>\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nset [able to select? v] to [1]\n\nwhen I receive [teleportin v]\nset [dash cooldown v] to [1]\nforever\n    set [scroll y v] to (round (Scroll Y))\nend\n\n