HitBox - Scrolling Platformer


@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [setup boss v]\nswitch backdrop to (backdrop2 v)\n\nwhen I receive [bosswin v]\nswitch backdrop to (backdrop3 v)\n\n@Player\n\ndefine In\nhide\nclear graphic effects\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nclear graphic effects\nshow\n\ndefine Out\nshow\nclear graphic effects\nshow\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nclear graphic effects\n\nwhen flag clicked\n\nwhen I receive [deleteallclones v]\ndelete this clone\n\nwhen I receive [setup v]\npoint in direction (90)\ngo to x: (0) y: (0)\nset size to (30) %\nclear graphic effects\nswitch costume to (hitbox v)\nshow\nset [xv v] to [0]\nset [yv v] to [0]\nset [invincible v] to [false]\nset [contactattack? v] to [false]\nset [prevcostume v] to [0]\nset [bossdead? v] to [false]\nset [scrollx v] to [0]\nset [walk v] to [0]\n\nwhen I receive [playerloop v]\nforever\n    Platform Engine [1.7] [10] [-1] [0.77]\n    if <key (h v) pressed?> then\n        wait until <key (i v) pressed?>\n        wait until <key (t v) pressed?>\n        wait until <key (b v) pressed?>\n        wait until <key (o v) pressed?>\n        wait until <key (x v) pressed?>\n        wait until <not <key (any v) pressed?>>\n        switch costume to (join [Hit] [BoxArt])\n        wait until <key (any v) pressed?>\n    end\n    if <(BossDead?) = [true]> then\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\ndefine Platform Engine (speed) (jumpheight) (gravity) (friction)\nswitch costume to (hitbox v)\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    if <(XV) < [0]> then\n        set [xv v] to [0.1]\n    end\n    change [xv v] by (speed)\n    point in direction (90)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    if <[0] < (XV)> then\n        set [xv v] to [-0.1]\n    end\n    change [xv v] by ((speed) * (-1))\n    point in direction (-90)\nend\nset [xv v] to ((XV) * (friction))\nchange x by (XV)\nif <<touching (level hitbox v)?> or <touching (boss hitbox v)?>> then\n    set [slope v] to [0]\n    repeat until <<<not <touching (level hitbox v)?>> and <not <touching (boss hitbox v)?>>> or <(Slope) = [8]>>\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <<touching (level hitbox v)?> or <touching (boss hitbox v)?>> then\n        change y by ((Slope) * (-1))\n        repeat ([ceiling v] of ([abs v] of (XV) ) )\n            if <<touching (level hitbox v)?> or <touching (boss hitbox v)?>> then\n                change x by ((([abs v] of (XV) ) / (XV)) * (-1))\n            end\n        end\n        set [xv v] to [0]\n    end\nend\nchange y by (YV)\nif <<touching (level hitbox v)?> or <touching (boss hitbox v)?>> then\n    repeat ([ceiling v] of ([abs v] of (YV) ) )\n        if <<touching (level hitbox v)?> or <touching (boss hitbox v)?>> then\n            change y by ((([abs v] of (YV) ) / (YV)) * (-1))\n        end\n    end\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <key (space v) pressed?>> then\n        TouchingFloor?\n        if <(TouchingFloor?) = [true]> then\n            start sound [Jump Sound Effect v]\n            set [yv v] to (jumpheight)\n        else\n            set [yv v] to [0]\n        end\n        set [touchingfloor? v] to [false]\n    else\n        set [yv v] to [0]\n    end\nelse\n    change [yv v] by (gravity)\nend\nchange [scrollx v] by (x position)\nset x to (0)\nif <(y position) < [-157]> then\n    if <(ScrollX) > [7400]> then\n        broadcast (StopMusic v)\n        start sound [Zoop v]\n        broadcast (Fall Down CutScene v)\n        stop [this script v]\n    else\n        Go To CheckPoint\n    end\nend\nif <touching (attack v)?> then\n    set [contactattack? v] to [true]\nend\nSet Costume\n\ndefine TouchingFloor?\nset [touchingfloor? v] to [false]\nset [prevcostume v] to (costume [number v])\nchange y by (-3)\nswitch costume to (floorhitbox v)\nset [touchingfloor? v] to <<touching (level hitbox v)?> or <touching (boss hitbox v)?>>\nchange y by (3)\nswitch costume to (PrevCostume)\n\ndefine Set Costume\nTouchingFloor?\nif <(TouchingFloor?) = [true]> then\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n        switch costume to (join [W] (((Walk) mod (1)) + (1)))\n    else\n        switch costume to (join [W] [1])\n    end\nelse\n    if <(YV) > [0]> then\n        switch costume to (join [J] [1])\n    else\n        switch costume to (join [F] [1])\n    end\nend\n\ndefine Go To CheckPoint\nif <(ScrollX) < [1605]> then\n    Reset At [0] [0]\nelse\n    if <<(ScrollX) > [1605]> and <(ScrollX) < [3500]>> then\n        Reset At [1605] [0]\n    else\n        if <<(ScrollX) > [3500]> and <(ScrollX) < [5490]>> then\n            Reset At [3500] [0]\n        else\n            if <<(ScrollX) > [5490]> and <(ScrollX) < [6605]>> then\n                Reset At [5490] [0]\n            else\n                Reset At [6605] [0]\n            end\n        end\n    end\nend\n\ndefine Reset At (scrollx) (y)\nset [scrollx v] to (scrollx)\nset [xv v] to [0]\nset [yv v] to [0]\npoint in direction (90)\nset y to (y)\nswitch costume to (f1 v)\n\nwhen I receive [fall down cutscene v]\npoint in direction (90)\nstop [other scripts in sprite v]\nswitch costume to (f1 v)\nrepeat until <(y position) < [-179]>\n    change x by (XV)\n    change y by (YV)\nend\nhide\ngo to x: (0) y: (0)\nwait (1) seconds\nbroadcast (Transition In v) and wait\nhide\nwait (1) seconds\nbroadcast (DeleteAllClones v) and wait\nbroadcast (SetUp Boss v) and wait\nbroadcast (BossLevelLoop v)\nwait (1) seconds\nbroadcast (Transition Out v) and wait\nbroadcast (Continue v) and wait\nbroadcast (PlayerLoop v)\nset [invincible v] to [false]\n\nset [touchingfloor? v] to [false]\nset [prevcostume v] to (costume [number v])\nchange y by (-3)\nswitch costume to (floorhitbox v)\nset [touchingfloor? v] to <touching (level hitbox v)?>\nchange y by (3)\nswitch costume to (PrevCostume)\n\nchange y by (10)\n\nwhen I receive [continue v]\nhide\nset y to (180)\npoint in direction (90)\nwait (1) seconds\nswitch costume to (f1 v)\nshow\nrepeat until <(y position) < [-50]>\n    change [yv v] by (-1)\n    change y by (YV)\nend\nswitch costume to (w1 v)\nset [yv v] to [0]\nset [xv v] to [0]\nset y to (-60)\nwait (1) seconds\nbroadcast (alert v)\nrepeat until <(ScrollX) > [580]>\n    change [scrollx v] by (XV)\n    change [xv v] by (0.2)\n    set x to ((0) - (ScrollX))\n    if <([abs v] of ((0) - (ScrollX)) ) > [240]> then\n        hide\n    else\n        show\n    end\nend\nstart sound [Music_Kzx-Stalemate.mp3 v]\nwait (2) seconds\nbroadcast (Boss Dialogue v) and wait\nwait (0.75) seconds\nbroadcast (BossJump v) and wait\nset [yv v] to [0]\nset [xv v] to [0]\nrepeat until <[0] > (ScrollX)>\n    change [scrollx v] by (XV)\n    change [xv v] by (-0.2)\n    set x to ((0) - (ScrollX))\n    if <([abs v] of ((0) - (ScrollX)) ) > [240]> then\n        hide\n    else\n        show\n    end\nend\nset [scrollx v] to [0]\nset [yv v] to [0]\nset [xv v] to [0]\nwait (1) seconds\nset [music v] to [2]\nstop all sounds\nbroadcast (BGMusic v)\nbroadcast (Trigger Boss Activity v)\n\nwhen [x v] key pressed\nset [x v] to (mouse x)\nset [y v] to (mouse y)\n\nwhen flag clicked\nhide\n\nwhen I receive [set var player v]\nset [contactattack? v] to [false]\n\nwhen I receive [playerloop v]\nwait until <(Invincible) = [false]>\nforever\n    wait until <(Invincible) = [true]>\n    clear graphic effects\n    repeat (25)\n        if <(LifeHP) > [0]> then\n            set [ghost v] effect to (100)\n            wait (0.0001) seconds\n            set [ghost v] effect to (0)\n            wait (0.0001) seconds\n        else\n            set [ghost v] effect to (0)\n            stop [other scripts in sprite v]\n            stop [this script v]\n        end\n    end\n    clear graphic effects\n    set [invincible v] to [false]\nend\n\nbroadcast (PlayBossBattle v) and wait\n\nwhen I receive [playbossbattle v]\n\nwait (1) seconds\nbroadcast (Transition In v) and wait\nhide\nwait (1) seconds\nbroadcast (DeleteAllClones v) and wait\nbroadcast (SetUp Boss v) and wait\nbroadcast (BossLevelLoop v)\nwait (1) seconds\nbroadcast (Transition Out v) and wait\nbroadcast (Continue v) and wait\nbroadcast (PlayerLoop v)\nset [invincible v] to [false]\n\nwhen I receive [playerhide v]\nhide\n\nwhen I receive [playerbounceback v]\nset [xv v] to ((([abs v] of (direction) ) / (direction)) * (-18))\nset [yv v] to [12]\n\nclear graphic effects\nrepeat (25)\n    if <(LifeHP) > [0]> then\n        set [ghost v] effect to (100)\n        wait (0.0001) seconds\n        set [ghost v] effect to (0)\n        wait (0.0001) seconds\n    else\n        set [ghost v] effect to (0)\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\nclear graphic effects\nset [invincible v] to [false]\n\nwhen I receive [exclamation dive v]\nwait (3) seconds\nswitch costume to (cutscene1 v)\nrepeat (8)\n    next costume\n    wait (0.03) seconds\nend\nwait (2) seconds\nOut\nnext costume\nIn\nwait (3) seconds\nbroadcast (Transition In v) and wait\nbroadcast (bossWIN v) and wait\nbroadcast (DeleteAllClones v) and wait\nhide\nbroadcast (Transition Out v) and wait\nwait (1) seconds\nbroadcast (Last Dialogue v) and wait\nbroadcast (tbc v) and wait\n\nwhen I receive [unowincutescene v]\npoint in direction (90)\n\nbroadcast (Transition Out v) and wait\n\nwhen I receive [alert v]\nplay sound [Alert v] until done\nplay sound [Alert v] until done\nplay sound [Alert v] until done\n\nset [music v] to [2]\nbroadcast (BGMusic v)\n\nset [music v] to [2]\nbroadcast (BGMusic v)\n\nif <<touching (level hitbox v)?> or <touching (boss hitbox v)?>> then\n    set [slope v] to [0]\n    repeat until <<<not <touching (level hitbox v)?>> and <not <touching (boss hitbox v)?>>> or <(Slope) = [8]>>\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <<touching (level hitbox v)?> or <touching (boss hitbox v)?>> then\n        change y by ((Slope) * (-1))\n        repeat ([ceiling v] of ([abs v] of (XV) ) )\n            if <<touching (level hitbox v)?> or <touching (boss hitbox v)?>> then\n                change x by ((([abs v] of (XV) ) / (XV)) * (-1))\n            end\n        end\n        set [xv v] to [0]\n    end\nend\n\n@Level Art\n\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [deleteallclones v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I receive [bosswin v]\nhide\n\ndelete this clone\n\nwhen I receive [deleteallclones v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nset [scrollx v] to [3085]\n\nwhen I receive [levelloop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\nshow\nclear graphic effects\nset [level_x v] to [0]\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Create\nrepeat (15)\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\ncreate clone of (_myself_ v)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\n\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\n@Level HitBox\n\nwhen I receive [deleteallclones v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen flag clicked\nhide\n\nset [scrollx v] to [3085]\n\nwhen I receive [levelloop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup v]\nshow\nclear graphic effects\nset [level_x v] to [0]\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Create\nrepeat (15)\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\ncreate clone of (_myself_ v)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\n\n@Transition\n\nwhen I receive [setup v]\n\ngo to x: (0) y: (0)\nshow\nchange y by (10)\n\nwhen I receive [transition in v]\nswitch costume to (costume1 v)\nhide\nshow\nstart sound [Disconnect v]\nrepeat (16)\n    next costume\nend\nbroadcast (StopMusic v)\n\nwhen I receive [transition out v]\nswitch costume to (costume17 v)\nstart sound [Connect v]\nrepeat (16)\n    switch costume to ((costume [number v]) - (1))\nend\nhide\n\ngo to x: (0) y: (0)\nswitch costume to (costume17 v)\nhide\n\ngo to [front v] layer\n\nwhen I receive [resetboss v]\nwait (1) seconds\nbroadcast (Transition In v) and wait\nbroadcast (PlayerHide v)\nwait (1) seconds\nbroadcast (DeleteAllClones v) and wait\nbroadcast (SetUp Boss v) and wait\nbroadcast (BossLevelLoop v)\nwait (1) seconds\nbroadcast (Transition Out v) and wait\nbroadcast (Continue v) and wait\nbroadcast (PlayerLoop v)\nset [invincible v] to [false]\n\nswitch costume to (costume1 v)\nhide\nshow\ngo to x: (0) y: (0)\nrepeat (16)\n    next costume\nend\nbroadcast (PlayBossBattle v) and wait\n\nwhen I receive [get back to main land v]\nbroadcast (Transition In v) and wait\nbroadcast (Generate v) and wait\nbroadcast (Transition Out v) and wait\n\n@Create\n\nwhen I receive [deleteallclones v]\ndelete this clone\n\nwhen I receive [generate v]\nbroadcast (DeleteAllClones v) and wait\nbroadcast (SetUp v) and wait\nbroadcast (LevelLoop v)\nbroadcast (PlayerLoop v)\nbroadcast (BGMusic v)\nbroadcast (OtherLoop v)\n\nwhen I receive [setup v]\n\nwhen I receive [setup boss v]\n\nbroadcast (BossMusic v)\n\nwhen I receive [>play button v]\nset [music v] to [1]\nbroadcast (Generate v)\n\n@Boss Art\n\nwhen flag clicked\nhide\n\nwhen I receive [bosswin v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nhide\n\nwhen I receive [deleteallclones v]\n\nwhen I receive [deleteallclones v]\ndelete this clone\n\nset [scrollx v] to [3085]\n\nwhen I receive [bosslevelloop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen I receive [setup boss v]\nshow\nclear graphic effects\nset [level_x v] to [0]\nset [scrollx v] to [0]\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Create\nrepeat (2)\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\ncreate clone of (_myself_ v)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\n\n@Boss HitBox\n\nwhen flag clicked\nhide\n\nwhen I receive [bosswin v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nhide\n\nwhen I receive [deleteallclones v]\ndelete this clone\n\nset [scrollx v] to [3085]\n\nwhen I receive [bosslevelloop v]\nforever\n    set x to ((Level_X) - (ScrollX))\n    if <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n        hide\n    else\n        show\n    end\n    set [ghost v] effect to (100)\nend\n\nwhen I receive [setup boss v]\nshow\nclear graphic effects\nset [level_x v] to [0]\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Create\nrepeat (2)\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\ncreate clone of (_myself_ v)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\n\n@Boss\n\nwhen I receive [setup boss v]\nset size to (35) %\nswitch costume to (costume1 v)\nset [bossx v] to [600]\nset [remainingpower v] to [5]\nset [yv v] to [0]\nset [bossdead? v] to [false]\nset [animate v] to [0]\nset [attackchance v] to [0]\nset [scrollblocksattack v] to [0]\nset rotation style [left-right v]\nset y to (-56)\npoint in direction (-90)\nhide\n\nwhen I receive [bosslevelloop v]\nforever\n    Scroll Blocks\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [recount v]\nforever\n    change [animate v] by (1)\n    wait (0.05) seconds\n    if <(Animate) > [9000]> then\n        set [animate v] to [1]\n    end\nend\n\nwhen I receive [bossjump v]\nset y to (-56)\nOut\nrepeat (2)\n    next costume\nend\nwait (2) seconds\nIn\nwait (1) seconds\nrepeat (20)\n    change y by (8)\nend\nwait (0.5) seconds\nrepeat (120)\n    switch costume to (((Animate) mod (6)) + (2))\nend\n\ndefine In\nhide\nclear graphic effects\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nclear graphic effects\nshow\n\ndefine Out\nshow\nclear graphic effects\nshow\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [trigger boss activity v]\nhide\nstop [other scripts in sprite v]\nbroadcast (recount v)\nwait (1) seconds\nforever\n    Scroll Blocks\n    if <not <<([floor v] of (ScrollX) ) < ([floor v] of ((BossX) + (50)) )> and <([floor v] of (ScrollX) ) > ([floor v] of ((BossX) + (-50)) )>>> then\n        point towards (player v)\n        change [bossx v] by ((([abs v] of (direction) ) / (direction)) * (4))\n        Scroll Blocks\n        switch costume to (((Animate) mod (6)) + (2))\n    else\n        if <((AttackChance) mod (25)) = [24]> then\n            Attack\n            change [remainingpower v] by (-1)\n            if <(RemainingPower) < [1]> then\n                switch costume to (costume2 v)\n                repeat (20)\n                    Scroll Blocks\n                    change y by (-8)\n                end\n                set [toolate v] to [0]\n                repeat until <<<([yv v] of [player v]) < [-1.1]> and <touching (player v)?>> or <(TooLate) > [125]>>\n                    Scroll Blocks\n                    change [toolate v] by (1)\n                end\n                if <<<([yv v] of [player v]) < [-1.1]> and <touching (player v)?>> and <[125] > (TooLate)>> then\n                    change [bosshp v] by (-1)\n                    broadcast (PlayerBounceBack v)\n                    broadcast (flash v)\n                end\n                set [remainingpower v] to [6]\n                if <(BossHP) > [0]> then\n                    clear graphic effects\n                    repeat (20)\n                        Scroll Blocks\n                        change y by (8)\n                    end\n                    clear graphic effects\n                else\n                    Death\n                    stop [this script v]\n                end\n            end\n        end\n    end\nend\n\ndefine Attack\nclear graphic effects\nset y to (104)\nset [prevbossx v] to (BossX)\nrepeat (15)\n    set [bossx v] to ((PrevBossX) + (pick random (-3) to (3)))\n    set y to ((104) + (pick random (-3) to (3)))\n    switch costume to (((Animate) mod (6)) + (2))\n    Scroll Blocks\nend\nset [scrollblocksattack v] to [false]\nbroadcast (Attack v) and wait\n\nwhen I receive [continue v]\nbroadcast (recount v)\n\ndefine Scroll Blocks\nset x to ((BossX) - (ScrollX))\nif <([abs v] of ((BossX) - (ScrollX)) ) > [240]> then\n    hide\nelse\n    show\nend\n\nrepeat (100)\nAttack\n\n\n\nwhen I receive [recount v]\nforever\n    change [attackchance v] by (1)\n    if <(AttackChance) > [9000]> then\n        set [attackchance v] to [1]\n    end\nend\n\nwait (pick random (0.2) to (0.6)) seconds\n\nwhen I receive [attack v]\nrepeat until <(ScrollBlocksAttack) = [true]>\n    switch costume to (((Animate) mod (6)) + (2))\n    Scroll Blocks\nend\n\nwhen I receive [resetboss v]\nstop [other scripts in sprite v]\nstop [other scripts in sprite v]\n\ndefine Death\nrepeat (30)\n    Scroll Blocks\nend\nset [bossdead? v] to [true]\nwait (1) seconds\nbroadcast (Transition In v) and wait\npoint in direction (90)\nset y to (-58)\nset x to (100)\nswitch costume to (cutsceme v)\nwait (1) seconds\nrepeat (18)\n    play sound (pick random (1) to (3)) until done\nend\nwait (1) seconds\nbroadcast (UnoWINcutescene v) and wait\nbroadcast (Transition Out v) and wait\nbroadcast (the actual cutscene unwin v) and wait\nstop [this script v]\n\nset [lifehp v] to [1]\n\nwhen I receive [flash v]\nrepeat (12)\n    set [ghost v] effect to (100)\n    wait (0.0001) seconds\n    set [ghost v] effect to (0)\n    wait (0.0001) seconds\nend\n\nif <(BossHP) > [0]> then\n\nset [bosshp v] to [1]\n\nwhen I receive [the actual cutscene unwin v]\nwait (1) seconds\npoint in direction (90)\nset y to (-58)\nset x to (100)\nswitch costume to (cutsceme v)\nswitch costume to (cutsceme v)\nrepeat (9)\n    next costume\n    wait (0.03) seconds\nend\nwait (1) seconds\nrepeat (14)\n    next costume\n    wait (0.005) seconds\nend\nstart sound [High Whoosh v]\nwait (1) seconds\nrepeat (20)\n    change y by (8)\nend\nrepeat (10)\n    change x by (-6)\nend\nwait (1) seconds\nbroadcast (Exclamation Dive v)\nrepeat (60)\n    go to x: (pick random (34) to (40)) y: (pick random (99) to (105))\nend\ngo to x: (37) y: (102)\n\nset [music v] to [2]\nbroadcast (BGMusic v)\n\nbroadcast (bossWIN v) and wait\n\n@Dialogue\n\nwhen I receive [setup boss v]\ngo to x: (0) y: (0)\nclear graphic effects\nswitch costume to (1 v)\nhide\n\nwhen I receive [boss dialogue v]\nswitch costume to (1 v)\nIn\nrepeat (7)\n    wait until <key (any v) pressed?>\n    wait until <not <key (any v) pressed?>>\n    Out\n    next costume\n    In\nend\nwait until <key (any v) pressed?>\nwait until <not <key (any v) pressed?>>\nOut\nnext costume\nIn\nwait until <key (any v) pressed?>\nwait until <not <key (any v) pressed?>>\nOut\nwait (1) seconds\n\ndefine In\nhide\nclear graphic effects\nset [ghost v] effect to (100)\nset [pixelate v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\n    change [pixelate v] effect by (-10)\nend\nclear graphic effects\nshow\n\ndefine Out\nshow\nclear graphic effects\nshow\nrepeat (10)\n    change [ghost v] effect by (10)\n    change [pixelate v] effect by (10)\nend\nhide\nclear graphic effects\n\nwhen flag clicked\nhide\n\ngo to [front v] layer\n\nwhen I receive [bosswin v]\nswitch costume to (10 v)\nIn\nrepeat (4)\n    wait until <key (any v) pressed?>\n    wait until <not <key (any v) pressed?>>\n    Out\n    next costume\n    In\nend\nwait until <key (any v) pressed?>\nwait until <not <key (any v) pressed?>>\nOut\nnext costume\nIn\nwait until <key (any v) pressed?>\nwait until <not <key (any v) pressed?>>\nOut\nwait (1) seconds\n\nwhen I receive [last dialogue v]\nswitch costume to (16 v)\nIn\nrepeat (7)\n    wait until <key (any v) pressed?>\n    wait until <not <key (any v) pressed?>>\n    Out\n    next costume\n    In\nend\nwait until <key (any v) pressed?>\nwait until <not <key (any v) pressed?>>\nOut\nnext costume\nIn\nwait until <key (any v) pressed?>\nwait until <not <key (any v) pressed?>>\nOut\nwait (1) seconds\n\n@Attack\n\nwhen flag clicked\nhide\n\nwhen I receive [setup boss v]\nset x to (0)\nset y to (47)\nset [attackx v] to [0]\nswitch costume to (costume1 v)\nset size to (50) %\nhide\n\nwhen I receive [attack v]\nset [attackx v] to ([bossx v] of [boss v])\nset [yv v] to [-2]\nset x to (([bossx v] of [boss v]) - (ScrollX))\nset y to (47)\nclear graphic effects\nbroadcast (Set Var Player v) and wait\nshow\nstart sound [Pew2 v]\nrepeat until <<(y position) < [-97]> or <([contactattack? v] of [player v]) = [true]>>\n    change y by (YV)\n    change [yv v] by (-0.4)\n    Scroll Blocks\nend\nif <([contactattack? v] of [player v]) = [true]> then\n    if <(Invincible) = [false]> then\n        set [invincible v] to [true]\n        change [lifehp v] by (-1)\n        if <(LifeHP) < [1]> then\n            broadcast (RESETBOSS v)\n            stop [this script v]\n        end\n    end\nend\nrepeat (5)\n    change [ghost v] effect by (20)\n    Scroll Blocks\nend\nset y to (47)\nset [scrollblocksattack v] to [true]\n\ndefine Scroll Blocks\nset x to ((AttackX) - (ScrollX))\nif <([abs v] of ((AttackX) - (ScrollX)) ) > [240]> then\n    hide\nelse\n    show\nend\n\nwhen I receive [unowincutescene v]\nset [scrollx v] to [480]\nhide\n\nwhen I receive [exclamation dive v]\nwait (3) seconds\nswitch costume to (costume3 v)\nclear graphic effects\nshow\nset y to (47)\nset x to (0)\nset [yv v] to [-2]\nstart sound [Pew v]\nrepeat until <(y position) < [0]>\n    change y by (YV)\n    change [yv v] by (-0.4)\nend\n\nwhen I receive [bosswin v]\nhide\n\n@Player Life\n\nwhen I receive [unowincutescene v]\nhide\n\nwhen I receive [unowincutescene v]\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [setup boss v]\nset [lifehp v] to [3]\nswitch costume to (life3 v)\ngo to x: (-213) y: (151)\nset size to (70) %\nshow\n\nwhen I receive [playerloop v]\nforever\n    switch costume to (join [Life] (LifeHP))\nend\n\n@Boss Life\n\nwhen I receive [unowincutescene v]\nstop [other scripts in sprite v]\ngo to x: (0) y: (0)\nswitch costume to (exclamation v)\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [setup boss v]\nset [bosshp v] to [3]\nswitch costume to (life3 v)\nclear graphic effects\ngo to x: (206) y: (151)\nset size to (70) %\nshow\n\nwhen I receive [playerloop v]\nforever\n    switch costume to (join [Life] (BossHP))\nend\n\nwhen I receive [exclamation dive v]\nshow\nclear graphic effects\nset [ghost v] effect to (100)\nrepeat (4)\n    change [ghost v] effect by (-25)\nend\nclear graphic effects\nwait (0.3) seconds\nrepeat (8)\n    change [ghost v] effect by (12.5)\nend\nclear graphic effects\nhide\n\n@Sprite1\n\nwhen I receive [bgmusic v]\nforever\n    play sound (Music) until done\nend\n\nwhen I receive [setup v]\nset volume to (100) %\n\nwhen I receive [stopmusic v]\nstop [other scripts in sprite v]\nstop all sounds\n\nwhen I receive [bossmusic v]\nforever\n    play sound [Relaxing Instrumental Music soft & calm background music - relaxdaily N080 \(mp3cut v] until done\nend\n\n@Sprite2\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [bosswin v]\nshow\n\n@Sprite3\n\nwhen flag clicked\ngo to x: (0) y: (0)\nclear graphic effects\nhide\n\nwhen I receive [tbc v]\nshow\nset [ghost v] effect to (100)\nrepeat (40)\n    change [ghost v] effect by (-2)\nend\nrepeat (40)\n    change [ghost v] effect by (-1)\nend\n\n@Sprite4\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nshow\ngo to [front v] layer\n\n@Sprite5\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nwait (1) seconds\nwait until <mouse down?>\nwait until <not <mouse down?>>\nbroadcast (Transition In v) and wait\nbroadcast (Generate v) and wait\nhide\nbroadcast (Transition Out v) and wait\n\n