run - 3D Platformer
@Stage\n\nwhen flag clicked\nwait (4) seconds\nforever\n    if <<(Dead) = [0]> and <not <<(Level) = [2]> and <(DoorsPassed) = [4]>>>> then\n        wait (0.5) seconds\n        if <(Level) = [1]> then\n            play sound [Stage Music 1 v] until done\n        else\n            play sound [Stage Music 2 v] until done\n        end\n    end\nend\n\n@Player\n\nwhen flag clicked\npoint in direction (90)\nset rotation style [left-right v]\nset size to (430) %\ngo to x: (-168) y: (0)\nset [globalcostumeno. v] to [0]\nset [playercostumeno. v] to [0]\nset [level v] to [1]\n\nwhen I receive [costumeeverything v]\nchange [playercostumeno. v] by ((0.1) + (<(Jumping) = [0]> * (([abs v] of (XVel) ) / (28))))\nchange [globalcostumeno. v] by (0.1)\nswitch costume to (idle1 v)\nif <(Dead) = [1]> then\n    switch costume to (dead v)\n    set rotation style [all around v]\n    point in direction ((([floor v] of ((GlobalCostumeNo.) * (4)) ) mod (4)) * (90))\nelse\n    if <<(StarTouched) = [1]> and <<(Level) = [2]> and <(DoorsPassed) = [0]>>> then\n        switch costume to (star v)\n    else\n        if <(AllowAbility) > [0]> then\n            change [allowability v] by (0.3)\n            if <(AllowAbility) > [1]> then\n                set [allowability v] to [1]\n            end\n        end\n        if <(AllowAbility) = [1]> then\n            set [usingability v] to [0]\n        end\n        if <(WaterShot) = [1]> then\n            point in direction (WaterShotDirection)\n            if <([abs v] of (WaterShotDirection) ) = [90]> then\n                switch costume to (swimattack1 v)\n            else\n                set rotation style [all around v]\n                switch costume to (swimattack2 v)\n                turn right (90) degrees\n            end\n            if <(AllowAbility) = [1]> then\n                set [watershot v] to [0]\n            end\n        else\n            if <not <(UsingAbility) = [0]>> then\n                if <(Ability) = [Beam]> then\n                    switch costume to (join [Beam] (([floor v] of (((GlobalCostumeNo.) * (5)) mod (2)) ) + (1)))\n                end\n                if <(Ability) = [Spark]> then\n                    if <(SparkState) = [2]> then\n                        switch costume to (join [Spark] (([floor v] of (((GlobalCostumeNo.) * (5)) mod (2)) ) + (2)))\n                    else\n                        switch costume to (spark1 v)\n                    end\n                end\n                if <(Ability) = [Fire]> then\n                    switch costume to (join [Fire] (([floor v] of (((GlobalCostumeNo.) * (4)) mod (2)) ) + (1)))\n                end\n            else\n                if <not <<(Sliding) = [0]> or <(Sliding) = [-1]>>> then\n                    switch costume to (slide1 v)\n                else\n                    if <(Swallowing) = [1]> then\n                        switch costume to (join [Swallow] (([floor v] of (((PlayerCostumeNo.) * (2)) mod (3)) ) + (1)))\n                        if <(([floor v] of (((PlayerCostumeNo.) * (2)) mod (3)) ) + (1)) = [3]> then\n                            set [swallowing v] to [0]\n                        end\n                    else\n                        if <(Sucking) = [1]> then\n                            if <(PlayerCostumeNo.) < [0.3]> then\n                                switch costume to (suck1 v)\n                            else\n                                if <(PlayerCostumeNo.) < [0.6]> then\n                                    switch costume to (suck2 v)\n                                else\n                                    switch costume to (suck3 v)\n                                end\n                            end\n                        else\n                            if <(Shooting) = [1]> then\n                                if <(YVel) = [0]> then\n                                    switch costume to (join [ShootGround] (([floor v] of (((PlayerCostumeNo.) * (3)) mod (4)) ) + (1)))\n                                    if <(([floor v] of (((PlayerCostumeNo.) * (3)) mod (4)) ) + (1)) = [4]> then\n                                        set [shooting v] to [0]\n                                    end\n                                else\n                                    switch costume to (join [ShootAir] (([floor v] of (((PlayerCostumeNo.) * (3)) mod (4)) ) + (1)))\n                                    if <(([floor v] of (((PlayerCostumeNo.) * (3)) mod (4)) ) + (1)) = [4]> then\n                                        set [shooting v] to [0]\n                                    end\n                                end\n                            else\n                                if <(Floating) = [1]> then\n                                    switch costume to (join [Float] (([floor v] of (((PlayerCostumeNo.) * (0.6)) mod (2)) ) + (1)))\n                                else\n                                    if <(Swimming) = [1]> then\n                                        if <(Holding) = [1]> then\n                                            switch costume to (join [Walk] (join (([floor v] of (((PlayerCostumeNo.) * (1.2)) mod (3)) ) + (1)) [H]))\n                                        else\n                                            if <([abs v] of (YVel) ) > (([abs v] of (XVel) ) + (1))> then\n                                                switch costume to (join [SwimV] (([floor v] of (((PlayerCostumeNo.) * (2)) mod (3)) ) + (1)))\n                                            else\n                                                switch costume to (join [SwimH] (([floor v] of (((PlayerCostumeNo.) * (2)) mod (4)) ) + (1)))\n                                            end\n                                        end\n                                    else\n                                        if <<(Jumping) = [1]> and <not <(Holding) = [1]>>> then\n                                            if <(YVel) = [0]> then\n                                                switch costume to (join [Jump] (([floor v] of (((PlayerCostumeNo.) * (2)) mod (3)) ) + (2)))\n                                                if <(([floor v] of (((PlayerCostumeNo.) * (2)) mod (4)) ) + (3)) = [6]> then\n                                                    switch costume to (idle1 v)\n                                                    set [jumping v] to [0]\n                                                end\n                                            else\n                                                switch costume to (jump1 v)\n                                                set [playercostumeno. v] to [0]\n                                            end\n                                        else\n                                            if <([abs v] of (XVel) ) > [0.2]> then\n                                                if <(Holding) = [1]> then\n                                                    switch costume to (join [Walk] (join (([floor v] of (((PlayerCostumeNo.) * (1.2)) mod (3)) ) + (1)) [H]))\n                                                else\n                                                    switch costume to (join [Walk] (([floor v] of (((PlayerCostumeNo.) * (1.2)) mod (4)) ) + (1)))\n                                                end\n                                            else\n                                                if <(Holding) = [1]> then\n                                                    switch costume to (idle1h v)\n                                                else\n                                                    switch costume to (join [Idle] (([floor v] of (((PlayerCostumeNo.) * (0.6)) mod (2)) ) + (1)))\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\nwhen I receive [updateplayer v]\ngo to x: ((PlayerX) + (MapX)) y: ((PlayerY) + (MapY))\nif <(AllowMovement) = [1]> then\n    if <(Sliding) > [0]> then\n        change [sliding v] by ((1) / (-15))\n        if <(Sliding) < [0]> then\n            set [sliding v] to [-1]\n        end\n    end\n    if <(Sliding) = [-1]> then\n        if <not <key (down arrow v) pressed?>> then\n            set [sliding v] to [0]\n        end\n    end\n    if <<not <key (z v) pressed?>> and <(AllowShot) = [0]>> then\n        set [allowshot v] to [1]\n    end\n    if <(Swimming) = [1]> then\n        Underwater\n    else\n        Ground\n    end\n    if <(y position) < [-160]> then\n        broadcast (Death v)\n    end\nend\nchange [mapx v] by ((((PlayerX) * (-1)) - (MapX)) / (2))\nif <<(DoorsPassed) = [3]> and <(Level) = [2]>> then\n    change [mapy v] by ([ceiling v] of ((((PlayerY) * (-1)) - (MapY)) / (8)) )\n    set [mapx v] to [-1408]\n    if <(MapY) < [4]> then\n        set [mapy v] to [4]\n    end\n    if <(MapY) > [416]> then\n        set [mapy v] to [416]\n    end\nelse\n    if <<(DoorsPassed) = [1]> and <(Level) = [2]>> then\n        if <(BossLocked) = [1]> then\n            set [mapx v] to [52]\n        end\n    end\n    if <(MapX) > [792]> then\n        set [mapx v] to [792]\n    end\n    if <<(DoorsPassed) = [0]> and <(Level) = [2]>> then\n        if <(MapX) < [-1434]> then\n            set [mapx v] to [-1434]\n        end\n    else\n        if <(MapX) < [-912]> then\n            set [mapx v] to [-912]\n        end\n    end\n    if <<(DoorsPassed) = [1]> and <(Level) = [2]>> then\n        if <(MapX) < [-362]> then\n            set [mapx v] to [-362]\n        end\n    end\nend\nchange y by (-1.2)\nbroadcast (CostumeEverything v)\n\ndefine GoToFloor\nrepeat until <<<touching (levels v)?> or <touching (blocks v)?>> or <<touching (semisolids v)?> and <not <((YVel) + (Gravity)) > [0]>>>>\n    change y by (-1)\nend\nchange y by (1)\n\ndefine GoToCeiling\nrepeat until <not <<<touching (levels v)?> or <touching (blocks v)?>> or <<touching (semisolids v)?> and <not <((YVel) + (Gravity)) > [0]>>>>>\n    change y by (-1)\nend\n\ndefine XFix\nset [playerx v] to ((x position) - (MapX))\nset [playery v] to ((y position) - (MapY))\nset [offset v] to [0]\nswitch costume to (hitboxsides v)\nrepeat until <<not <<touching (levels v)?> or <touching (blocks v)?>>> or <([abs v] of (Offset) ) > [40]>>\n    if <(Offset) > [0]> then\n        change [offset v] by (0.5)\n    else\n        change [offset v] by (-0.5)\n    end\n    set [offset v] to ((Offset) * (-1))\n    change x by (Offset)\nend\nswitch costume to (hitboxbottom v)\nif <([abs v] of (Offset) ) > [40]> then\n    set x to ((PlayerX) + (MapX))\n    set [offset v] to [0]\n    repeat until <<not <<touching (levels v)?> or <touching (blocks v)?>>> or <([abs v] of (Offset) ) > [40]>>\n        if <(Offset) > [0]> then\n            change [offset v] by (0.5)\n        else\n            change [offset v] by (-0.5)\n        end\n        set [offset v] to ((Offset) * (-1))\n        change y by (Offset)\n    end\nend\nif <([abs v] of (Offset) ) > [40]> then\n    set y to ((PlayerY) + (MapY))\nend\n\ndefine YSmoothing\nrepeat (12)\n    if <<<touching (levels v)?> or <touching (blocks v)?>> or <<touching (semisolids v)?> and <not <((YVel) + (Gravity)) > [0]>>>> then\n        change y by (1)\n    end\nend\nif <<<touching (levels v)?> or <touching (blocks v)?>> or <<touching (semisolids v)?> and <not <((YVel) + (Gravity)) > [0]>>>> then\n    change y by (-12)\nend\n\nwhen I receive [resetplayer v]\nset [health v] to [5]\nset [globalcostumeno. v] to [0]\nset [playercostumeno. v] to [0]\nset [floating v] to [0]\nset [sucking v] to [0]\nset [holding v] to [0]\nset [gravity v] to [-4]\nset [xvel v] to [0]\nset [yvel v] to [0]\nset [playerx v] to [-960]\nset [playery v] to [365]\nset [mapx v] to [960]\nset [mapy v] to [-365]\nset [doorspassed v] to [0]\nset [allowmovement v] to [1]\nset [allowplayerdamage v] to [1]\nset [ability v] to [None]\nset [holdingtype v] to [0]\nset [allowability v] to [1]\nset [bossdefeated v] to [0]\nset [bosslocked v] to [0]\nset [dead v] to [0]\nset [startouched v] to [0]\npoint in direction (90)\nset rotation style [left-right v]\nset size to (430) %\ngo to x: (-168) y: (0)\nclear graphic effects\n\nwhen flag clicked\nforever\n    if <(Sucking) = [1]> then\n        if <not <(YVel) = [0]>> then\n            wait (0.1) seconds\n        end\n        if <(Sucking) = [1]> then\n            play sound [01 v] until done\n            repeat until <(Sucking) = [0]>\n                start sound [01B v]\n            end\n        end\n    end\nend\n\ndefine ClingToFloor\nrepeat (24)\n    if <not <<<touching (levels v)?> or <touching (blocks v)?>> or <<touching (semisolids v)?> and <not <((YVel) + (Gravity)) > [0]>>>>> then\n        change y by (-1)\n    end\nend\nif <not <<<touching (levels v)?> or <touching (blocks v)?>> or <<touching (semisolids v)?> and <not <((YVel) + (Gravity)) > [0]>>>>> then\n    change y by (24)\nend\nchange y by (1)\n\ndefine Beam\nadd ((PlayerX) / ((8) * (4.3))) to [attackx v]\nadd ((PlayerY) / ((8) * (4.3))) to [attacky v]\nadd [0] to [attackstate v]\nadd [4] to [attacktype v]\nif <(direction) = [90]> then\n    add [10] to [attackdir v]\nelse\n    add [-10] to [attackdir v]\nend\nadd ((PlayerX) / ((8) * (4.3))) to [attackx v]\nadd ((PlayerY) / ((8) * (4.3))) to [attacky v]\nadd [1] to [attackstate v]\nadd [4] to [attacktype v]\nif <(direction) = [90]> then\n    add [10] to [attackdir v]\nelse\n    add [-10] to [attackdir v]\nend\nadd ((PlayerX) / ((8) * (4.3))) to [attackx v]\nadd ((PlayerY) / ((8) * (4.3))) to [attacky v]\nadd [2] to [attackstate v]\nadd [4] to [attacktype v]\nif <(direction) = [90]> then\n    add [10] to [attackdir v]\nelse\n    add [-10] to [attackdir v]\nend\nadd ((PlayerX) / ((8) * (4.3))) to [attackx v]\nadd ((PlayerY) / ((8) * (4.3))) to [attacky v]\nadd [3] to [attackstate v]\nadd [4] to [attacktype v]\nif <(direction) = [90]> then\n    add [10] to [attackdir v]\nelse\n    add [-10] to [attackdir v]\nend\n\nwhen I receive [attackend v]\nif <not <(AllowAbility) = [0.1]>> then\n    set [xvel v] to [0.01]\n    set [yvel v] to [0.01]\n    set [allowability v] to [0.1]\nend\n\ndefine UseAbility\nif <(Ability) = [Beam]> then\n    start sound [50 v]\n    Beam\n    set [usingability v] to [1]\n    set [allowability v] to [0]\n    set [allowshot v] to [0]\nend\nif <(Ability) = [Spark]> then\n    set [usingability v] to [1]\n    set [allowability v] to [0]\n    set [allowshot v] to [0]\n    broadcast (UseSpark v)\nend\nif <(Ability) = [Fire]> then\n    set [usingability v] to [1]\n    set [allowability v] to [0]\n    set [allowshot v] to [0]\n    broadcast (UseFire v)\nend\n\nwhen I receive [newability v]\ngo to [front v] layer\nwait until <(Swallowing) = [0]>\nUseAbility\nwait (1.2) seconds\ngo [backward v] (12) layers\n\nwhen I receive [updatemap v]\nset rotation style [left-right v]\nswitch costume to (hitboxsides v)\n\ndefine Underwater\nset [sucking v] to [0]\nif <(Floating) = [1]> then\n    set [yvel v] to [7]\n    set [swimming v] to [0]\n    Ground\n    stop [this script v]\nend\nif <(YVel) < [-0.5]> then\n    set [yvel v] to [-0.5]\nend\nif <((YVel) + (Gravity)) > [0]> then\n    switch costume to (hitboxtop v)\nelse\n    switch costume to (hitboxbottom v)\nend\nif <<<key (x v) pressed?> or <key (up arrow v) pressed?>> and <<(UsingAbility) = [0]> and <(Holding) = [0]>>> then\n    if <(YVel) = [0]> then\n        change [yvel v] by (2)\n    end\n    change [yvel v] by (0.3)\nend\nif <<key (down arrow v) pressed?> and <<(UsingAbility) = [0]> and <(Holding) = [0]>>> then\n    change [yvel v] by (-0.3)\nend\nchange y by ((YVel) + ((Gravity) / (2)))\nif <<<touching (levels v)?> or <touching (blocks v)?>> or <<touching (semisolids v)?> and <not <((YVel) + ((Gravity) / (2))) > [0]>>>> then\n    if <((YVel) + ((Gravity) / (2))) > [0]> then\n        GoToCeiling\n        if <key (up arrow v) pressed?> then\n            set [yvel v] to [9]\n        else\n            set [yvel v] to [0]\n        end\n    else\n        change y by (((YVel) + ((Gravity) / (2))) * (-1))\n        GoToFloor\n        set [yvel v] to [0]\n    end\nend\nswitch costume to (hitboxsides v)\nif <(UsingAbility) = [0]> then\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n        change [xvel v] by (-0.3)\n    end\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n        change [xvel v] by (0.3)\n    end\nend\nif <<(UsingAbility) = [1]> and <([abs v] of (XVel) ) < [0.01]>> then\n    set [xvel v] to [0.01]\nend\nchange x by (XVel)\nif <<touching (levels v)?> or <touching (blocks v)?>> then\n    YSmoothing\nend\nif <<touching (levels v)?> or <touching (blocks v)?>> then\n    XFix\n    set [xvel v] to [0.01]\nend\nif <(YVel) = [0]> then\n    set [xvel v] to ((XVel) / (1.1))\n    set [yvel v] to ((YVel) / (1.1))\nelse\n    set [xvel v] to ((XVel) / (1.05))\n    set [yvel v] to ((YVel) / (1.05))\nend\nset [playerx v] to ((x position) - (MapX))\nset [playery v] to ((y position) - (MapY))\nif <<key (z v) pressed?> and <(AllowShot) = [1]>> then\n    set [playercostumeno. v] to [0]\n    set [allowshot v] to [0]\n    if <(Holding) = [1]> then\n        set [holding v] to [0]\n        set [shooting v] to [1]\n        start sound [1B v]\n        add (((PlayerX) / ((8) * (4.3))) + ((direction) / (360))) to [attackx v]\n        add ((PlayerY) / ((8) * (4.3))) to [attacky v]\n        add [0] to [attackstate v]\n        add [1] to [attacktype v]\n        add (direction) to [attackdir v]\n    else\n        if <(AllowAbility) = [1]> then\n            set [watershot v] to [1]\n            set [usingability v] to [1]\n            set [allowability v] to [0]\n            if <key (up arrow v) pressed?> then\n                add ((PlayerX) / ((8) * (4.3))) to [attackx v]\n                add (((PlayerY) / ((8) * (4.3))) + (0.25)) to [attacky v]\n                add [0] to [attackstate v]\n                add [5] to [attacktype v]\n                add [0] to [attackdir v]\n                set [watershotdirection v] to [0]\n            else\n                if <key (down arrow v) pressed?> then\n                    add ((PlayerX) / ((8) * (4.3))) to [attackx v]\n                    add (((PlayerY) / ((8) * (4.3))) + (-0.25)) to [attacky v]\n                    add [0] to [attackstate v]\n                    add [5] to [attacktype v]\n                    add [180] to [attackdir v]\n                    set [watershotdirection v] to [180]\n                else\n                    if <key (left arrow v) pressed?> then\n                        add (((PlayerX) / ((8) * (4.3))) + ((direction) / (360))) to [attackx v]\n                        add ((PlayerY) / ((8) * (4.3))) to [attacky v]\n                        add [0] to [attackstate v]\n                        add [5] to [attacktype v]\n                        add [-90] to [attackdir v]\n                        set [watershotdirection v] to [-90]\n                    else\n                        add (((PlayerX) / ((8) * (4.3))) + ((direction) / (360))) to [attackx v]\n                        add ((PlayerY) / ((8) * (4.3))) to [attacky v]\n                        add [0] to [attackstate v]\n                        add [5] to [attacktype v]\n                        add (direction) to [attackdir v]\n                        set [watershotdirection v] to (direction)\n                    end\n                end\n            end\n        end\n    end\nelse\n    if <<<key (down arrow v) pressed?> and <(AllowShot) = [1]>> and <<(Holding) = [1]> and <(YVel) = [0]>>> then\n        set [ability v] to (HoldingType)\n        broadcast (NewAbility v)\n        set [playercostumeno. v] to [0]\n        set [holding v] to [0]\n        set [swallowing v] to [1]\n        set [sliding v] to [-1]\n    end\nend\n\ndefine Ground\nif <<<key (up arrow v) pressed?> and <(AllowShot) = [1]>> and <<(Holding) = [0]> and <<(Sucking) = [0]> and <(UsingAbility) = [0]>>>> then\n    if <(YVel) < [5]> then\n        set [yvel v] to [10]\n        change y by ((YVel) + (Gravity))\n        start sound [48 v]\n    end\n    set [floating v] to [1]\nend\nif <(Holding) = [1]> then\n    set [floating v] to [0]\n    set [jumping v] to [0]\nend\nif <(Floating) = [1]> then\n    change [yvel v] by ((Gravity) / (6.9))\n    if <(YVel) < [-0.5]> then\n        set [yvel v] to [-0.5]\n    end\nelse\n    change [yvel v] by ((Gravity) / (5.6))\n    if <not <key (x v) pressed?>> then\n        set [yvel v] to ((YVel) / (1.1))\n    end\nend\nif <((YVel) + (Gravity)) > [0]> then\n    switch costume to (hitboxtop v)\nelse\n    switch costume to (hitboxbottom v)\nend\nchange y by ((YVel) + (Gravity))\nif <<<touching (levels v)?> or <touching (blocks v)?>> or <<touching (semisolids v)?> and <not <((YVel) + (Gravity)) > [0]>>>> then\n    if <((YVel) + (Gravity)) > [0]> then\n        GoToCeiling\n        set [yvel v] to [0]\n    else\n        change y by (((YVel) + (Gravity)) * (-1))\n        GoToFloor\n        if <(Floating) = [1]> then\n            set [playercostumeno. v] to [0]\n            set [floating v] to [0]\n            start sound [1A v]\n            add (((PlayerX) / ((8) * (4.3))) + ((direction) / (180))) to [attackx v]\n            add ((PlayerY) / ((8) * (4.3))) to [attacky v]\n            add [0] to [attackstate v]\n            add [2] to [attacktype v]\n            add (direction) to [attackdir v]\n            set [shooting v] to [1]\n            set [sucking v] to [0]\n            set [playercostumeno. v] to [0]\n            set [allowshot v] to [0]\n            set [jumping v] to [0]\n        end\n        set [yvel v] to [0]\n        if <<<key (x v) pressed?> and <not <key (down arrow v) pressed?>>> and <(UsingAbility) = [0]>> then\n            set [yvel v] to [16]\n        end\n    end\nend\nif <not <<(YVel) = [0]> or <(YVel) = (((Gravity) / (5.6)) / (1.1))>>> then\n    set [jumping v] to [1]\n    if <<<(Floating) = [0]> and <<(Swallowing) = [0]> and <(Shooting) = [0]>>> and <<(Sucking) = [0]> and <(Holding) = [0]>>> then\n        set [playercostumeno. v] to [0]\n    end\nend\nif <<(YVel) = [0]> or <(YVel) = (((Gravity) / (5.6)) / (1.1))>> then\n    if <<<key (down arrow v) pressed?> and <key (x v) pressed?>> and <<(Sliding) = [0]> and <<<(Floating) = [0]> and <<(Swallowing) = [0]> and <(Shooting) = [0]>>> and <<<(Sucking) = [0]> and <(UsingAbility) = [0]>> and <(Holding) = [0]>>>>> then\n        set [sliding v] to [1]\n    end\nend\nswitch costume to (hitboxsides v)\nif <<<(Sucking) = [0]> and <(UsingAbility) = [0]>> and <<(Sliding) = [0]> or <(Sliding) = [-1]>>> then\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n        change [xvel v] by ((-0.5) - (<(Running) = [1]> * (0.3)))\n    end\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n        change [xvel v] by ((0.5) - (<(Running) = [1]> * (-0.3)))\n    end\nend\nif <<(UsingAbility) = [1]> and <([abs v] of (XVel) ) < [0.01]>> then\n    set [xvel v] to [0.01]\nend\nchange x by (XVel)\nif <touching (levels v)?> then\n    YSmoothing\nend\nif <not <<(Sliding) = [0]> or <(Sliding) = [-1]>>> then\n    set [xvel v] to ((direction) / (15))\n    ClingToFloor\n    if <touching (enemies v)?> then\n        set [attackx v] to (x position)\n        set [attacky v] to (y position)\n        set [attackdir v] to (direction)\n        broadcast (AttackHit v)\n    end\nend\nif <<touching (levels v)?> or <touching (blocks v)?>> then\n    XFix\n    set [xvel v] to [0.01]\nend\nif <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>> then\n    set [xvel v] to ((XVel) / (1.15))\nelse\n    set [xvel v] to ((XVel) / (1.3))\nend\nset [playerx v] to ((x position) - (MapX))\nset [playery v] to ((y position) - (MapY))\nif <<<key (z v) pressed?> and <(AllowShot) = [1]>> and <(Holding) = [0]>> then\n    if <(Sucking) = [0]> then\n        set [playercostumeno. v] to [0]\n    end\n    if <(Floating) = [1]> then\n        start sound [1A v]\n        add (((PlayerX) / ((8) * (4.3))) + ((direction) / (360))) to [attackx v]\n        add ((PlayerY) / ((8) * (4.3))) to [attacky v]\n        add [0] to [attackstate v]\n        add [2] to [attacktype v]\n        add (direction) to [attackdir v]\n        set [shooting v] to [1]\n        set [sucking v] to [0]\n        set [playercostumeno. v] to [0]\n        set [allowshot v] to [0]\n    else\n        if <(Ability) = [None]> then\n            set [sucking v] to [1]\n            if <([floor v] of (((GlobalCostumeNo.) * (7)) mod (3)) ) = [1]> then\n                add (((PlayerX) / ((8) * (4.3))) + ((direction) / (pick random (30) to (30)))) to [attackx v]\n                add (((PlayerY) / ((8) * (4.3))) + (([sin v] of ((GlobalCostumeNo.) * (360)) ) * (1.5))) to [attacky v]\n                add [0] to [attackstate v]\n                add [3] to [attacktype v]\n                add [0] to [attackdir v]\n            end\n        end\n        if <(AllowAbility) = [1]> then\n            UseAbility\n        end\n    end\n    set [floating v] to [0]\nelse\n    set [sucking v] to [0]\nend\nif <<key (a v) pressed?> and <not <(Ability) = [None]>>> then\n    add ((PlayerX) / ((8) * (4.3))) to [attackx v]\n    add ((PlayerY) / ((8) * (4.3))) to [attacky v]\n    add (Ability) to [attackstate v]\n    add [6] to [attacktype v]\n    if <(direction) = [90]> then\n        add [-45] to [attackdir v]\n    else\n        add [45] to [attackdir v]\n    end\n    set [ability v] to [None]\nend\nif <<<key (z v) pressed?> and <(AllowShot) = [1]>> and <(Holding) = [1]>> then\n    start sound [1B v]\n    set [playercostumeno. v] to [0]\n    set [shooting v] to [1]\n    set [allowshot v] to [0]\n    set [holding v] to [0]\n    add (((PlayerX) / ((8) * (4.3))) + ((direction) / (360))) to [attackx v]\n    add ((PlayerY) / ((8) * (4.3))) to [attacky v]\n    add [0] to [attackstate v]\n    add [1] to [attacktype v]\n    add (direction) to [attackdir v]\nelse\n    if <<<key (down arrow v) pressed?> and <(AllowShot) = [1]>> and <<(Holding) = [1]> and <(YVel) = [0]>>> then\n        set [ability v] to (HoldingType)\n        if <not <(Ability) = [None]>> then\n            broadcast (NewAbility v)\n        end\n        set [playercostumeno. v] to [0]\n        set [holding v] to [0]\n        set [swallowing v] to [1]\n        set [sliding v] to [-1]\n    end\nend\nif <<<(Level) = [2]> and <(AllowPlayerDamage) = [1]>> and <<(DoorsPassed) = [3]> and <<(y position) < [-117]> and <<(x position) < [4]> and <(x position) > [-65]>>>>> then\n    broadcast (TakeDamage v)\nend\n\nwhen flag clicked\nforever\n    if <<key (right arrow v) pressed?> and <(AllowMovement) = [1]>> then\n        set [running v] to [0]\n        reset timer\n        wait until <<not <key (right arrow v) pressed?>> or <(timer) > [0.3]>>\n        if <not <<(timer) > [0.3]> or <key (left arrow v) pressed?>>> then\n            reset timer\n            wait until <<key (right arrow v) pressed?> or <(timer) > [0.3]>>\n            if <not <<(timer) > [0.3]> or <key (left arrow v) pressed?>>> then\n                set [running v] to [1]\n                wait until <<not <key (right arrow v) pressed?>> or <<key (left arrow v) pressed?> or <([abs v] of (XVel) ) < [0.05]>>>\n                set [running v] to [0]\n            end\n        end\n    end\nend\n\nwhen I receive [flight v]\nset [allowmovement v] to [0]\nset [allowplayerdamage v] to [0]\nwait (0.5) seconds\nreset timer\nrepeat (60)\n    change [playerx v] by (12)\n    change [playery v] by (([cos v] of ((timer) * (270)) ) * (15))\nend\nset [allowmovement v] to [1]\nset [allowplayerdamage v] to [1]\n\nwhen I receive [flight v]\nwait (2) seconds\nbroadcast (Door v)\n\nwhen flag clicked\nforever\n    if <<key (left arrow v) pressed?> and <(AllowMovement) = [1]>> then\n        set [running v] to [0]\n        reset timer\n        wait until <<not <key (left arrow v) pressed?>> or <(timer) > [0.3]>>\n        if <not <<(timer) > [0.3]> or <key (right arrow v) pressed?>>> then\n            reset timer\n            wait until <<key (left arrow v) pressed?> or <(timer) > [0.3]>>\n            if <not <<(timer) > [0.3]> or <key (right arrow v) pressed?>>> then\n                set [running v] to [1]\n                wait until <<not <key (left arrow v) pressed?>> or <<key (right arrow v) pressed?> or <([abs v] of (XVel) ) < [0.05]>>>\n                set [running v] to [0]\n            end\n        end\n    end\nend\n\nwhen I receive [usespark v]\nset [sparkstate v] to [1]\nwait (0.1) seconds\nrepeat (30)\n    set [sparkstate v] to [2]\n    if <([floor v] of (((GlobalCostumeNo.) * (7)) mod (4)) ) = [1]> then\n        start sound [3A v]\n        add ((PlayerX) / ((8) * (4.3))) to [attackx v]\n        add ((PlayerY) / ((8) * (4.3))) to [attacky v]\n        add [0] to [attackstate v]\n        add [7] to [attacktype v]\n        add (([sin v] of ((GlobalCostumeNo.) * (180)) ) * ((100) + (<not <(YVel) = [0]>> * (80)))) to [attackdir v]\n    end\nend\nset [sparkstate v] to [3]\nwait (0.1) seconds\nbroadcast (AttackEnd v)\n\nwhen I receive [takedamage v]\nset [allowplayerdamage v] to [0]\nif <(Health) < [1.1]> then\n    broadcast (Death v)\n    stop [this script v]\nend\nstart sound [1C v]\nif <(Sliding) = [0]> then\n    if <not <(Ability) = [None]>> then\n        add ((PlayerX) / ((8) * (4.3))) to [attackx v]\n        add ((PlayerY) / ((8) * (4.3))) to [attacky v]\n        add (Ability) to [attackstate v]\n        add [6] to [attacktype v]\n        if <(direction) = [90]> then\n            add [-45] to [attackdir v]\n        else\n            add [45] to [attackdir v]\n        end\n    end\n    set [ability v] to [None]\n    set [yvel v] to [16]\n    set [xvel v] to ((direction) / (-9))\n    repeat (10)\n        change [health v] by (-0.1)\n        set [ghost v] effect to (0)\n        wait (0.05) seconds\n        set [ghost v] effect to (100)\n        wait (0.05) seconds\n    end\n    clear graphic effects\nend\nset [allowplayerdamage v] to [1]\nset [health v] to (round (Health))\n\nwhen I receive [usefire v]\nrepeat (30)\n    set [sparkstate v] to [2]\n    if <([floor v] of (((GlobalCostumeNo.) * (7)) mod (4)) ) = [1]> then\n        start sound [3D v]\n        add (((PlayerX) + ((direction) / (4))) / ((8) * (4.3))) to [attackx v]\n        add ((PlayerY) / ((8) * (4.3))) to [attacky v]\n        add [0] to [attackstate v]\n        add [8] to [attacktype v]\n        add ((direction) + (([sin v] of ((GlobalCostumeNo.) * (180)) ) * (30))) to [attackdir v]\n    end\nend\nbroadcast (AttackEnd v)\n\nwhen I receive [death v]\nset [dead v] to [1]\nset [allowplayerdamage v] to [0]\nset [allowmovement v] to [0]\nstop all sounds\nstart sound [1C v]\nstart sound [Lost Life v]\nwait (0.5) seconds\nset [yvel v] to [12]\nrepeat (75)\n    change [yvel v] by ((Gravity) / (5))\n    change [playery v] by (YVel)\n    if <(y position) < [-180]> then\n        set [ghost v] effect to (100)\n    end\nend\nset [level v] to [1]\nbroadcast (ResetPlayer v) and wait\nbroadcast (LoadStuff v) and wait\nstop all sounds\n\n@Levels\n\nwhen flag clicked\nset [cloneno. v] to [1]\ncreate clone of (_myself_ v)\nset [cloneno. v] to [0]\nbroadcast (ResetPlayer v) and wait\nwait (4) seconds\nforever\n    set [swimming v] to [0]\n    broadcast (UpdateMap v)\nend\n\nwhen I receive [updatemap v]\nshow\nswitch costume to (sizebypass v)\nset size to (430) %\nif <(CloneNo.) = [1]> then\n    switch costume to (join [LevelB] (Level))\nelse\n    switch costume to (join [LevelA] (Level))\nend\ngo to x: ((MapX) + ((CloneNo.) * (2064))) y: (MapY)\nif <([abs v] of ((MapX) + ((CloneNo.) * (2064))) ) > [1270]> then\n    hide\nend\nif <(CloneNo.) = [0]> then\n    broadcast (UpdateAll v)\nend\n\nwhen I receive [door v]\nif <(CloneNo.) = [0]> then\n    wait (0.5) seconds\n    set [globalcostumeno. v] to [0]\n    change [health v] by (1)\n    if <(Health) > [5]> then\n        set [health v] to [5]\n    end\n    set [doorallow v] to [15]\n    change [doorspassed v] by (1)\n    if <<(DoorsPassed) = [3]> and <(Level) = [2]>> then\n        set [playerx v] to [1258]\n        set [playery v] to [-528]\n    else\n        set [playerx v] to [-960]\n        set [mapx v] to [960]\n        change [mapy v] by (365)\n        set [playery v] to (((MapY) + (77)) * (-1))\n        if <(DoorsPassed) = [3]> then\n            set [playerx v] to [-960]\n            set [mapx v] to [960]\n            set [mapy v] to [-365]\n            set [playery v] to (((MapY) + (77)) * (-1))\n            set [doorspassed v] to [0]\n            if <(Level) = [1]> then\n                change [level v] by (1)\n                set [health v] to [5]\n                stop all sounds\n            end\n        end\n        if <<(DoorsPassed) = [2]> and <(Level) = [2]>> then\n            set [playery v] to (((MapY) + (-160)) * (-1))\n            set [playerx v] to [-930]\n        end\n    end\nend\n\n@SemiSolids\n\nwhen flag clicked\nset [cloneno. v] to [1]\ncreate clone of (_myself_ v)\nset [cloneno. v] to [0]\n\nwhen I receive [updatemap v]\nshow\nswitch costume to (sizebypass v)\nset size to (430) %\nif <(CloneNo.) = [1]> then\n    switch costume to (join [LevelB] (Level))\nelse\n    switch costume to (join [LevelA] (Level))\nend\ngo to x: ((MapX) + ((CloneNo.) * (2064))) y: (MapY)\ngo to [back v] layer\nif <([abs v] of ((MapX) + ((CloneNo.) * (2064))) ) > [1270]> then\n    hide\nend\n\n@Background\n\nwhen I receive [updateall v]\ngo to [back v] layer\nshow\nswitch costume to (sizebypass v)\nset size to (430) %\nif <(CloneNo.) = [1]> then\n    switch costume to (join [LevelB] (Level))\nelse\n    switch costume to (join [LevelA] (Level))\n    if <(Level) = [1]> then\n        if <(([floor v] of ((GlobalCostumeNo.) * (1)) ) mod (2)) = [1]> then\n            switch costume to (levela12 v)\n        end\n    end\nend\ngo to x: ((MapX) + ((CloneNo.) * (2064))) y: (MapY)\nif <([abs v] of ((MapX) + ((CloneNo.) * (2064))) ) > [1270]> then\n    hide\nend\nif <(CloneNo.) = [0]> then\n    broadcast (UpdatePlayer v)\nend\n\nwhen flag clicked\nset [cloneno. v] to [1]\ncreate clone of (_myself_ v)\nset [cloneno. v] to [0]\n\n@Doors\n\nwhen flag clicked\nset [cloneno. v] to [1]\ncreate clone of (_myself_ v)\nset [cloneno. v] to [0]\nwait (1) seconds\nwait until <(Level) = [2]>\nbroadcast (LoadStuff v) and wait\n\nwhen I receive [updateall v]\nshow\nif <(DoorAllow) > [0]> then\n    change [doorallow v] by (-0.1)\n    if <(DoorAllow) < [0]> then\n        set [doorallow v] to [0]\n    end\nend\nswitch costume to (sizebypass v)\nset size to (430) %\nif <(CloneNo.) = [1]> then\n    switch costume to (join [LevelB] (Level))\nelse\n    switch costume to (join [LevelA] (Level))\nend\ngo to x: ((MapX) + ((CloneNo.) * (2064))) y: (MapY)\nif <<touching (player v)?> and <(DoorAllow) = [0]>> then\n    if <key (down arrow v) pressed?> then\n        if <<(Level) = [2]> and <(DoorsPassed) = [3]>> then\n            start sound [07 v]\n            set [doorallow v] to [200]\n            broadcast (GameEnd v)\n        else\n            start sound [07 v]\n            set [doorallow v] to [5]\n            broadcast (Door v)\n        end\n    end\nend\nhide\n\n@Enemies\n\nwhen flag clicked\nset rotation style [left-right v]\nswitch costume to (1 v)\nset size to (430) %\nset [level v] to [1]\nbroadcast (LoadStuff v) and wait\n\ndefine FormEnemies\nshow\nset [enemyno. v] to [0]\nrepeat (length of [enemyx v])\n    change [enemyno. v] by (1)\n    go to x: (((item (EnemyNo.) of [enemyx v]) * ((8) * (4.3))) + (MapX)) y: (((item (EnemyNo.) of [enemyy v]) * ((8) * (4.3))) + (MapY))\n    if <<([abs v] of (((item (EnemyNo.) of [enemyx v]) * ((8) * (4.3))) + (MapX)) ) < [240]> and <([abs v] of (((item (EnemyNo.) of [enemyy v]) * ((8) * (4.3))) + (MapY)) ) < [180]>> then\n        point in direction (item (EnemyNo.) of [enemydirection v])\n        create clone of (_myself_ v)\n    end\nend\nchange [enemyno. v] by (1)\nhide\n\nwhen I receive [updateall v]\nset [x v] to (round (((mouse x) - (MapX)) / ((8) * (4.3))))\nset [y v] to (round (((mouse y) - (MapY)) / ((8) * (4.3))))\nif <[1] = [1]> then\n    delete this clone\nend\nDeleteEnemies\nFormEnemies\n\nwhen I receive [costumeeverything v]\nif <(item (EnemyNo.) of [enemytype v]) = [1]> then\n    switch costume to (([floor v] of (((GlobalCostumeNo.) * (1.2)) mod (2)) ) + (1))\nend\nif <(item (EnemyNo.) of [enemytype v]) = [2]> then\n    if <<(item (EnemyNo.) of [enemystate v]) > [0]> and <(item (EnemyNo.) of [enemystate v]) < [18]>> then\n        switch costume to ((([floor v] of (((GlobalCostumeNo.) * (4)) mod (2)) ) + (2)) * (2))\n    else\n        if <(item (EnemyNo.) of [enemystate v]) = [0]> then\n            switch costume to (([floor v] of (((GlobalCostumeNo.) * (1.2)) mod (2)) ) + (3))\n        else\n            switch costume to (4 v)\n        end\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [3]> then\n    if <([floor v] of (((GlobalCostumeNo.) * (0.1)) mod (2)) ) = [0]> then\n        switch costume to ((([floor v] of (((GlobalCostumeNo.) * (1)) mod (4)) ) * (2)) + (7))\n    else\n        switch costume to ((([floor v] of (((GlobalCostumeNo.) * (1)) mod (3)) ) * (2)) + (8))\n        if <(((GlobalCostumeNo.) * (0.1)) mod (2)) > [1.5]> then\n            switch costume to (([floor v] of (((GlobalCostumeNo.) * (1)) mod (3)) ) + (15))\n        end\n    end\n    if <(((GlobalCostumeNo.) * (0.1)) mod (2)) < [0.01]> then\n        add (((x position) - (MapX)) / ((8) * (4.3))) to [enemyattackx v]\n        add ((((y position) - (MapY)) / ((8) * (4.3))) + (1.5)) to [enemyattacky v]\n        add [0] to [enemyattackstate v]\n        add [2] to [enemyattacktype v]\n        if <(direction) = [90]> then\n            add [10] to [enemyattackdir v]\n        else\n            add [-10] to [enemyattackdir v]\n        end\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [4]> then\n    if <(item (EnemyNo.) of [enemystate v]) > [0]> then\n        switch costume to (([floor v] of (((GlobalCostumeNo.) * (4)) mod (2)) ) + (21))\n    else\n        if <(item (EnemyNo.) of [enemyyvelocity v]) = [0]> then\n            switch costume to (([floor v] of (((GlobalCostumeNo.) * (1)) mod (2)) ) + (19))\n        else\n            switch costume to (18 v)\n        end\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [5]> then\n    if <(item (EnemyNo.) of [enemystate v]) = [0]> then\n        switch costume to (([floor v] of (((GlobalCostumeNo.) * (1.2)) mod (2)) ) + (23))\n    else\n        if <(item (EnemyNo.) of [enemystate v]) < [20]> then\n            switch costume to (([floor v] of (((GlobalCostumeNo.) * (4)) mod (2)) ) + (25))\n        else\n            switch costume to (([floor v] of (((GlobalCostumeNo.) * (4)) mod (2)) ) + (27))\n            if <([floor v] of (((GlobalCostumeNo.) * (7)) mod (4)) ) = [1]> then\n                add ((((x position) + ((direction) / (5))) - (MapX)) / ((8) * (4.3))) to [enemyattackx v]\n                add (((y position) - (MapY)) / ((8) * (4.3))) to [enemyattacky v]\n                add [0] to [enemyattackstate v]\n                add [4] to [enemyattacktype v]\n                add ((direction) + (([sin v] of ((GlobalCostumeNo.) * (180)) ) * (30))) to [enemyattackdir v]\n            end\n        end\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [6]> then\n    switch costume to (([floor v] of (((GlobalCostumeNo.) * (1.2)) mod (2)) ) + (29))\nend\nif <(item (EnemyNo.) of [enemytype v]) = [7]> then\n    switch costume to (([floor v] of (((GlobalCostumeNo.) * (1.2)) mod (2)) ) + (31))\nend\nif <(item (EnemyNo.) of [enemytype v]) = [8]> then\n    switch costume to (([floor v] of (((GlobalCostumeNo.) * (3)) mod (4)) ) + (33))\nend\nif <(item (EnemyNo.) of [enemytype v]) = [9]> then\n    if <([abs v] of (direction) ) = [90]> then\n        switch costume to (37 v)\n    else\n        if <([abs v] of (direction) ) = [45]> then\n            switch costume to (38 v)\n        else\n            switch costume to (39 v)\n        end\n    end\nend\n\ndefine MakeEnemy (x) (y) (dir) (type) (health)\nadd (x) to [enemyx v]\nadd ((y) + (0.4)) to [enemyy v]\nadd (dir) to [enemydirection v]\nadd (type) to [enemytype v]\nadd (health) to [enemyhealth v]\nadd [0] to [enemystate v]\nadd [0] to [enemyyvelocity v]\n\nwhen I start as a clone\nswitch costume to (hitbox v)\nif <<not <((item (EnemyNo.) of [enemyhealth v]) mod (1)) = [0]>> and <not <(item (EnemyNo.) of [enemyhealth v]) < [1]>>> then\n    if <(((round (((item (EnemyNo.) of [enemyhealth v]) mod (1)) * (10))) / (10)) mod (0.1)) = [0]> then\n        set [brightness v] effect to (50)\n    end\nend\nif <<not <((item (EnemyNo.) of [enemyhealth v]) mod (1)) = [0]>> and <not <(item (EnemyNo.) of [enemyhealth v]) < [1]>>> then\n    replace item (EnemyNo.) of [enemyhealth v] with ((item (EnemyNo.) of [enemyhealth v]) - (0.05))\n    if <((item (EnemyNo.) of [enemyhealth v]) mod (1)) > [0.9]> then\n        replace item (EnemyNo.) of [enemyhealth v] with ([ceiling v] of (item (EnemyNo.) of [enemyhealth v]) )\n    end\nend\nif <(item (EnemyNo.) of [enemyhealth v]) < [1]> then\n    replace item (EnemyNo.) of [enemyyvelocity v] with ((item (EnemyNo.) of [enemyyvelocity v]) + ((Gravity) / (5.6)))\n    if <((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) > [0]> then\n        move ((item (EnemyNo.) of [enemyyvelocity v]) / (3)) steps\n        change y by ((Gravity) + (item (EnemyNo.) of [enemyyvelocity v]))\n        replace item (EnemyNo.) of [enemyy v] with (((y position) - (MapY)) / ((8) * (4.3)))\n        replace item (EnemyNo.) of [enemyx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n    end\n    if <(((round ((item (EnemyNo.) of [enemyhealth v]) * (10))) / (10)) mod (0.2)) = [0]> then\n        set [brightness v] effect to (50)\n    end\n    turn right (180) degrees\n    replace item (EnemyNo.) of [enemyhealth v] with ((item (EnemyNo.) of [enemyhealth v]) - (0.05))\n    if <(item (EnemyNo.) of [enemyhealth v]) < [0]> then\n        hide\n        add (EnemyNo.) to [deleteenemies v]\n    end\nelse\n    if <<<(Sucking) = [1]> and <<(item (EnemyNo.) of [enemyhealth v]) < [2]> and <not <(item (EnemyNo.) of [enemytype v]) = [3]>>>> and <<(distance to [player v]) < [120]> and <<<([direction v] of [player v]) = [90]> and <(x position) > ([x position v] of [player v])>> or <<([direction v] of [player v]) = [-90]> and <([x position v] of [player v]) > (x position)>>>>> then\n        change y by (-8)\n        point towards (player v)\n        change y by (8)\n        move ((((120) - (distance to [player v])) / (16)) + (2)) steps\n        if <(item (EnemyNo.) of [enemytype v]) = [6]> then\n            change y by (([sin v] of ((GlobalCostumeNo.) * (50)) ) * (50))\n        end\n        if <(distance to [player v]) < [24]> then\n            hide\n            set [sucking v] to [0]\n            set [allowshot v] to [0]\n            set [holding v] to [1]\n            set [holdingtype v] to [None]\n            if <(item (EnemyNo.) of [enemytype v]) = [2]> then\n                set [holdingtype v] to [Beam]\n            end\n            if <(item (EnemyNo.) of [enemytype v]) = [4]> then\n                set [holdingtype v] to [Spark]\n            end\n            if <(item (EnemyNo.) of [enemytype v]) = [5]> then\n                set [holdingtype v] to [Fire]\n            end\n            add (EnemyNo.) to [deleteenemies v]\n        end\n    else\n        EnemyMovement\n        if <<touching (player v)?> and <(AllowPlayerDamage) = [1]>> then\n            broadcast (TakeDamage v)\n        end\n    end\n    replace item (EnemyNo.) of [enemyx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n    if <not <(item (EnemyNo.) of [enemytype v]) = [6]>> then\n        replace item (EnemyNo.) of [enemyy v] with (((y position) - (MapY)) / ((8) * (4.3)))\n    end\nend\nchange y by (-2)\n\ndefine GoToFloor\nrepeat until <<touching (levels v)?> or <touching (semisolids v)?>>\n    change y by (-1)\nend\nchange y by (1)\n\ndefine GoToCeiling\nrepeat until <<touching (levels v)?> or <touching (semisolids v)?>>\n    change y by (1)\nend\nchange y by (-1)\n\ndefine DeleteEnemies\nrepeat until <(length of [deleteenemies v]) = [0]>\n    if <(item (item (1) of [deleteenemies v]) of [enemytype v]) = [3]> then\n        set [bosslocked v] to [0]\n    end\n    delete (item (1) of [deleteenemies v]) of [enemydirection v]\n    delete (item (1) of [deleteenemies v]) of [enemystate v]\n    delete (item (1) of [deleteenemies v]) of [enemytype v]\n    delete (item (1) of [deleteenemies v]) of [enemyx v]\n    delete (item (1) of [deleteenemies v]) of [enemyy v]\n    delete (item (1) of [deleteenemies v]) of [enemyyvelocity v]\n    delete (item (1) of [deleteenemies v]) of [enemyhealth v]\n    delete (1) of [deleteenemies v]\nend\n\nwhen I receive [attackhit v]\nif <<<(item (EnemyNo.) of [enemyhealth v]) > [0.6]> and <not <<(item (EnemyNo.) of [enemytype v]) = [8]> or <(item (EnemyNo.) of [enemytype v]) = [9]>>>> and <((item (EnemyNo.) of [enemyhealth v]) mod (1)) = [0]>> then\n    if <<([abs v] of ((AttackX) - (x position)) ) < [32]> and <([abs v] of ((AttackY) - (y position)) ) < [32]>> then\n        start sound [1C v]\n        replace item (EnemyNo.) of [enemyy v] with (((y position) - (MapY)) / ((8) * (4.3)))\n        replace item (EnemyNo.) of [enemyx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n        replace item (EnemyNo.) of [enemydirection v] with (AttackDir)\n        replace item (EnemyNo.) of [enemyhealth v] with ((item (EnemyNo.) of [enemyhealth v]) - (0.1))\n        if <(item (EnemyNo.) of [enemyhealth v]) < [1]> then\n            replace item (EnemyNo.) of [enemyyvelocity v] with [12]\n            replace item (EnemyNo.) of [enemyhealth v] with [0.6]\n        end\n    end\nend\n\ndefine EnemyMovement\nswitch costume to (hitbox v)\nif <(item (EnemyNo.) of [enemytype v]) = [1]> then\n    replace item (EnemyNo.) of [enemyyvelocity v] with ((item (EnemyNo.) of [enemyyvelocity v]) + ((Gravity) / (5.6)))\n    change y by ((Gravity) + (item (EnemyNo.) of [enemyyvelocity v]))\n    if <<touching (levels v)?> or <touching (semisolids v)?>> then\n        change y by (((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) * (-1))\n        if <((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) > [0]> then\n            GoToCeiling\n        else\n            GoToFloor\n        end\n        replace item (EnemyNo.) of [enemyyvelocity v] with [0]\n    end\n    move (2) steps\n    if <touching (levels v)?> then\n        YSmoothing\n    end\n    if <touching (levels v)?> then\n        turn right (180) degrees\n        replace item (EnemyNo.) of [enemydirection v] with (direction)\n        move (2) steps\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [2]> then\n    replace item (EnemyNo.) of [enemyyvelocity v] with ((item (EnemyNo.) of [enemyyvelocity v]) + ((Gravity) / (5.6)))\n    change y by ((Gravity) + (item (EnemyNo.) of [enemyyvelocity v]))\n    if <<touching (levels v)?> or <touching (semisolids v)?>> then\n        change y by (((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) * (-1))\n        if <((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) > [0]> then\n            GoToCeiling\n        else\n            GoToFloor\n        end\n        replace item (EnemyNo.) of [enemyyvelocity v] with [0]\n    end\n    if <(item (EnemyNo.) of [enemystate v]) = [0]> then\n        if <(x position) > ([x position v] of [player v])> then\n            point in direction (-90)\n        else\n            point in direction (90)\n        end\n        replace item (EnemyNo.) of [enemydirection v] with (direction)\n        switch costume to (front v)\n        move (2) steps\n        if <touching (levels v)?> then\n            move (-2) steps\n            replace item (EnemyNo.) of [enemyyvelocity v] with [12]\n        end\n        switch costume to (hitbox v)\n        if <(distance to [player v]) < [120]> then\n            move (-2) steps\n            replace item (EnemyNo.) of [enemystate v] with [1]\n        end\n    end\n    if <(item (EnemyNo.) of [enemystate v]) > [0]> then\n        if <(item (EnemyNo.) of [enemystate v]) < [18]> then\n            replace item (EnemyNo.) of [enemystate v] with ((item (EnemyNo.) of [enemystate v]) + (0.5))\n            if <not <(item (EnemyNo.) of [enemystate v]) < [18]>> then\n                add (((x position) - (MapX)) / ((8) * (4.3))) to [enemyattackx v]\n                add (((y position) - (MapY)) / ((8) * (4.3))) to [enemyattacky v]\n                add [0] to [enemyattackstate v]\n                add [1] to [enemyattacktype v]\n                if <(direction) = [90]> then\n                    add [10] to [enemyattackdir v]\n                else\n                    add [-10] to [enemyattackdir v]\n                end\n                add (((x position) - (MapX)) / ((8) * (4.3))) to [enemyattackx v]\n                add (((y position) - (MapY)) / ((8) * (4.3))) to [enemyattacky v]\n                add [1] to [enemyattackstate v]\n                add [1] to [enemyattacktype v]\n                if <(direction) = [90]> then\n                    add [10] to [enemyattackdir v]\n                else\n                    add [-10] to [enemyattackdir v]\n                end\n                add (((x position) - (MapX)) / ((8) * (4.3))) to [enemyattackx v]\n                add (((y position) - (MapY)) / ((8) * (4.3))) to [enemyattacky v]\n                add [2] to [enemyattackstate v]\n                add [1] to [enemyattacktype v]\n                if <(direction) = [90]> then\n                    add [10] to [enemyattackdir v]\n                else\n                    add [-10] to [enemyattackdir v]\n                end\n                add (((x position) - (MapX)) / ((8) * (4.3))) to [enemyattackx v]\n                add (((y position) - (MapY)) / ((8) * (4.3))) to [enemyattacky v]\n                add [3] to [enemyattackstate v]\n                add [1] to [enemyattacktype v]\n                if <(direction) = [90]> then\n                    add [10] to [enemyattackdir v]\n                else\n                    add [-10] to [enemyattackdir v]\n                end\n            end\n        else\n            replace item (EnemyNo.) of [enemystate v] with ((item (EnemyNo.) of [enemystate v]) + (0.5))\n            if <(item (EnemyNo.) of [enemystate v]) > [40]> then\n                replace item (EnemyNo.) of [enemystate v] with [-1]\n            end\n        end\n    end\n    if <(item (EnemyNo.) of [enemystate v]) < [0]> then\n        replace item (EnemyNo.) of [enemystate v] with ((item (EnemyNo.) of [enemystate v]) + (0.1))\n        if <(item (EnemyNo.) of [enemystate v]) > [0]> then\n            replace item (EnemyNo.) of [enemystate v] with [0]\n        end\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [3]> then\n    switch costume to (hitbox2 v)\n    if <(x position) > ([x position v] of [player v])> then\n        point in direction (-90)\n    else\n        point in direction (90)\n    end\n    if <<(MapX) < [54]> and <(DoorAllow) = [0]>> then\n        set [bosslocked v] to [1]\n    end\n    replace item (EnemyNo.) of [enemyyvelocity v] with ((item (EnemyNo.) of [enemyyvelocity v]) + ((Gravity) / (5.6)))\n    change y by ((Gravity) + (item (EnemyNo.) of [enemyyvelocity v]))\n    if <touching (levels v)?> then\n        change y by (((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) * (-1))\n        if <((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) > [0]> then\n            GoToCeiling\n            replace item (EnemyNo.) of [enemyyvelocity v] with [0]\n        else\n            GoToFloor\n            replace item (EnemyNo.) of [enemyyvelocity v] with [16]\n            if <<(item (EnemyNo.) of [enemystate v]) = [1]> and <(x position) < [200]>> then\n                replace item (EnemyNo.) of [enemystate v] with [0]\n            else\n                replace item (EnemyNo.) of [enemystate v] with [1]\n            end\n        end\n    end\n    if <((item (EnemyNo.) of [enemystate v]) mod (2)) = [1]> then\n        move (2) steps\n        if <touching (levels v)?> then\n            turn right (180) degrees\n            replace item (EnemyNo.) of [enemydirection v] with (direction)\n            move (2) steps\n        end\n    end\n    if <((item (EnemyNo.) of [enemystate v]) mod (2)) = [0]> then\n        move (-2) steps\n        if <touching (levels v)?> then\n            turn right (180) degrees\n            replace item (EnemyNo.) of [enemydirection v] with (direction)\n            move (-2) steps\n        end\n    end\n    if <([abs v] of (x position) ) > [230]> then\n        change x by ((([abs v] of (x position) ) / (x position)) * (-5))\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [4]> then\n    switch costume to (hitbox v)\n    if <(x position) > ([x position v] of [player v])> then\n        point in direction (-90)\n    else\n        point in direction (90)\n    end\n    replace item (EnemyNo.) of [enemyyvelocity v] with ((item (EnemyNo.) of [enemyyvelocity v]) + ((Gravity) / (5.6)))\n    change y by ((Gravity) + (item (EnemyNo.) of [enemyyvelocity v]))\n    if <<touching (levels v)?> or <touching (semisolids v)?>> then\n        change y by (((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) * (-1))\n        if <((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) > [0]> then\n            GoToCeiling\n            replace item (EnemyNo.) of [enemyyvelocity v] with [0]\n        else\n            GoToFloor\n            replace item (EnemyNo.) of [enemyyvelocity v] with [0]\n            if <(item (EnemyNo.) of [enemystate v]) = [0]> then\n                if <(((GlobalCostumeNo.) * (0.4)) mod (6)) > [5.9]> then\n                    replace item (EnemyNo.) of [enemyyvelocity v] with [12]\n                end\n                if <(distance to [player v]) < [120]> then\n                    replace item (EnemyNo.) of [enemystate v] with [1]\n                end\n            end\n        end\n    end\n    if <(item (EnemyNo.) of [enemystate v]) > [0]> then\n        replace item (EnemyNo.) of [enemystate v] with ((item (EnemyNo.) of [enemystate v]) + (0.1))\n        if <([floor v] of (((GlobalCostumeNo.) * (7)) mod (4)) ) = [1]> then\n            add (((x position) - (MapX)) / ((8) * (4.3))) to [enemyattackx v]\n            add (((y position) - (MapY)) / ((8) * (4.3))) to [enemyattacky v]\n            add [0] to [enemyattackstate v]\n            add [3] to [enemyattacktype v]\n            add (([sin v] of ((GlobalCostumeNo.) * (360)) ) * (90)) to [enemyattackdir v]\n        end\n        if <(item (EnemyNo.) of [enemystate v]) > [8]> then\n            replace item (EnemyNo.) of [enemystate v] with [0]\n        end\n    end\n    if <<(item (EnemyNo.) of [enemystate v]) = [0]> and <not <(item (EnemyNo.) of [enemyyvelocity v]) = [0]>>> then\n        move (2) steps\n        if <touching (levels v)?> then\n            turn right (180) degrees\n            replace item (EnemyNo.) of [enemydirection v] with (direction)\n            move (2) steps\n        end\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [5]> then\n    replace item (EnemyNo.) of [enemyyvelocity v] with ((item (EnemyNo.) of [enemyyvelocity v]) + ((Gravity) / (5.6)))\n    change y by ((Gravity) + (item (EnemyNo.) of [enemyyvelocity v]))\n    if <<touching (levels v)?> or <touching (semisolids v)?>> then\n        change y by (((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) * (-1))\n        if <((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) > [0]> then\n            GoToCeiling\n        else\n            GoToFloor\n        end\n        replace item (EnemyNo.) of [enemyyvelocity v] with [0]\n    end\n    if <(item (EnemyNo.) of [enemystate v]) > [0]> then\n        replace item (EnemyNo.) of [enemystate v] with ((item (EnemyNo.) of [enemystate v]) + (1))\n        if <(item (EnemyNo.) of [enemystate v]) > [60]> then\n            replace item (EnemyNo.) of [enemystate v] with [0]\n        end\n    end\n    if <(item (EnemyNo.) of [enemystate v]) = [0]> then\n        move (2) steps\n        if <touching (levels v)?> then\n            turn right (180) degrees\n            replace item (EnemyNo.) of [enemydirection v] with (direction)\n            move (2) steps\n        end\n        if <(distance to [player v]) < [100]> then\n            if <(x position) > ([x position v] of [player v])> then\n                point in direction (-90)\n            else\n                point in direction (90)\n            end\n            replace item (EnemyNo.) of [enemydirection v] with (direction)\n            replace item (EnemyNo.) of [enemystate v] with [1]\n        end\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [6]> then\n    change y by (([sin v] of ((GlobalCostumeNo.) * (50)) ) * (50))\n    move (3) steps\n    if <touching (levels v)?> then\n        turn right (180) degrees\n        replace item (EnemyNo.) of [enemydirection v] with (direction)\n        move (3) steps\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [7]> then\n    replace item (EnemyNo.) of [enemyyvelocity v] with ((item (EnemyNo.) of [enemyyvelocity v]) + ((Gravity) / (5.6)))\n    change y by ((Gravity) + (item (EnemyNo.) of [enemyyvelocity v]))\n    if <<touching (levels v)?> or <touching (semisolids v)?>> then\n        change y by (((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) * (-1))\n        if <((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) > [0]> then\n            GoToCeiling\n            replace item (EnemyNo.) of [enemyyvelocity v] with [0]\n        else\n            GoToFloor\n            replace item (EnemyNo.) of [enemyyvelocity v] with [10]\n            if <<(item (EnemyNo.) of [enemystate v]) = [1]> and <(x position) < [200]>> then\n                replace item (EnemyNo.) of [enemystate v] with [0]\n            else\n                replace item (EnemyNo.) of [enemystate v] with [1]\n            end\n        end\n    end\n    if <(item (EnemyNo.) of [enemystate v]) = [1]> then\n        point in direction (-90)\n    else\n        point in direction (90)\n    end\n    move (2) steps\n    if <touching (levels v)?> then\n        turn right (180) degrees\n        replace item (EnemyNo.) of [enemydirection v] with (direction)\n        move (2) steps\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [8]> then\n    change y by (([cos v] of ((direction) + (90)) ) * (3))\n    if <<touching (levels v)?> or <touching (blocks v)?>> then\n        change y by (([cos v] of ((direction) + (90)) ) * (-3))\n        turn right (180) degrees\n        replace item (EnemyNo.) of [enemydirection v] with (direction)\n    end\nend\nif <(item (EnemyNo.) of [enemytype v]) = [9]> then\n    replace item (EnemyNo.) of [enemyyvelocity v] with ((item (EnemyNo.) of [enemyyvelocity v]) + ((Gravity) / (5.6)))\n    change y by ((Gravity) + (item (EnemyNo.) of [enemyyvelocity v]))\n    if <<touching (levels v)?> or <touching (semisolids v)?>> then\n        change y by (((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) * (-1))\n        if <((Gravity) + (item (EnemyNo.) of [enemyyvelocity v])) > [0]> then\n            GoToCeiling\n        else\n            GoToFloor\n        end\n        replace item (EnemyNo.) of [enemyyvelocity v] with [0]\n    end\n    if <([floor v] of (((GlobalCostumeNo.) * (12)) mod (180)) ) = [1]> then\n        point towards (player v)\n        point in direction ((round ((direction) / (45))) * (45))\n        if <(direction) > [90]> then\n            point in direction (90)\n        end\n        if <(direction) < [-90]> then\n            point in direction (-90)\n        end\n        if <(direction) = (item (EnemyNo.) of [enemydirection v])> then\n            add ((((x position) + (([sin v] of (direction) ) * (12))) - (MapX)) / ((8) * (4.3))) to [enemyattackx v]\n            add ((((y position) + (([cos v] of (direction) ) * (12))) - (MapY)) / ((8) * (4.3))) to [enemyattacky v]\n            add [0] to [enemyattackstate v]\n            add [5] to [enemyattacktype v]\n            add (direction) to [enemyattackdir v]\n        end\n        replace item (EnemyNo.) of [enemydirection v] with (direction)\n    end\nend\n\nwhen I receive [loadstuff v]\ndelete all of [enemydirection v]\ndelete all of [enemystate v]\ndelete all of [enemytype v]\ndelete all of [enemyx v]\ndelete all of [enemyy v]\ndelete all of [enemyyvelocity v]\ndelete all of [enemyhealth v]\ndelete all of [deleteenemies v]\nif <(Level) = [1]> then\n    MakeEnemy [-10.5] [9] [-90] [2] [1]\n    MakeEnemy [-8] [8] [-90] [1] [1]\n    MakeEnemy [-7] [11] [-90] [6] [1]\n    MakeEnemy [0] [8] [-90] [2] [1]\n    MakeEnemy [4] [12] [-90] [6] [1]\n    MakeEnemy [8] [9] [-90] [4] [1]\n    MakeEnemy [15] [9] [-90] [1] [1]\n    MakeEnemy [17] [13] [-90] [6] [1]\n    MakeEnemy [29] [9] [-90] [5] [1]\n    MakeEnemy [-17] [-2] [-90] [1] [1]\n    MakeEnemy [-6] [1.5] [-90] [4] [1]\n    MakeEnemy [0] [-2] [-90] [1] [1]\n    MakeEnemy [12] [0] [-90] [5] [1]\n    MakeEnemy [18] [3] [-90] [6] [1]\n    MakeEnemy [27.5] [-2] [-90] [4] [1]\n    MakeEnemy [-13] [-12] [-90] [7] [1]\n    MakeEnemy [-15] [-9] [-90] [5] [1]\n    MakeEnemy [-9] [-8] [-90] [1] [1]\n    MakeEnemy [-4] [-10] [-90] [2] [1]\n    MakeEnemy [3] [-9] [-90] [6] [1]\n    MakeEnemy [12] [-11] [-90] [5] [1]\n    MakeEnemy [19] [-8] [-90] [7] [1]\n    MakeEnemy [22] [-13] [-90] [1] [1]\n    MakeEnemy [28] [-9] [-90] [6] [1]\nend\nif <(Level) = [2]> then\n    MakeEnemy [3] [-3] [-90] [3] [5]\n    MakeEnemy [-15] [8] [-90] [8] [3]\n    MakeEnemy [-7] [9] [-90] [1] [1]\n    MakeEnemy [0] [8] [-90] [2] [1]\n    MakeEnemy [12] [10] [-90] [9] [3]\n    MakeEnemy [19] [11] [-90] [4] [1]\n    MakeEnemy [22] [9] [-90] [8] [3]\n    MakeEnemy [-17] [0] [-90] [6] [1]\n    MakeEnemy [-14] [0] [-90] [6] [1]\n    MakeEnemy [-13] [1] [-90] [6] [1]\n    MakeEnemy [7] [1] [-90] [6] [1]\n    MakeEnemy [9] [2] [-90] [6] [1]\n    MakeEnemy [11] [0] [-90] [6] [1]\n    MakeEnemy [-21] [-6] [-90] [5] [1]\n    MakeEnemy [-17] [-9] [-90] [1] [1]\n    MakeEnemy [-14] [-8] [-90] [7] [1]\n    MakeEnemy [3] [-9] [-90] [1] [1]\n    MakeEnemy [10] [-13] [-90] [2] [1]\n    MakeEnemy [16] [-14] [-90] [7] [1]\n    MakeEnemy [13] [-10] [-90] [8] [3]\n    MakeEnemy [19] [-10] [-90] [1] [1]\n    MakeEnemy [26] [-9] [-90] [7] [1]\n    MakeEnemy [30] [-14.5] [-90] [4] [1]\n    MakeEnemy [45] [-15] [-90] [1] [1]\n    MakeEnemy [41] [-9.5] [-90] [7] [1]\n    MakeEnemy [41] [-2] [-90] [7] [1]\n    MakeEnemy [42] [-1] [-90] [2] [1]\nend\n\ndefine FindEmptySpace\nrepeat until <<not <touching (levels v)?>> or <([abs v] of (y position) ) > [170]>>\n    change y by (1)\nend\n\ndefine YSmoothing\nrepeat (10)\n    if <touching (levels v)?> then\n        change y by (1)\n    end\nend\nif <touching (levels v)?> then\n    change y by (-10)\nend\n\n@PlayerAttacks\n\nwhen flag clicked\nset rotation style [left-right v]\nset size to (430) %\n\ndefine FormAttacks\nshow\nset [attackno. v] to [0]\nrepeat (length of [attackx v])\n    change [attackno. v] by (1)\n    go to x: (((item (AttackNo.) of [attackx v]) * ((8) * (4.3))) + (MapX)) y: (((item (AttackNo.) of [attacky v]) * ((8) * (4.3))) + (MapY))\n    if <<([abs v] of (((item (AttackNo.) of [attackx v]) * ((8) * (4.3))) + (MapX)) ) < [238]> and <([abs v] of (((item (AttackNo.) of [attacky v]) * ((8) * (4.3))) + (MapY)) ) < [180]>> then\n        point in direction (item (AttackNo.) of [attackdir v])\n        create clone of (_myself_ v)\n    else\n        add (AttackNo.) to [deleteattacks v]\n    end\nend\nhide\n\nwhen I receive [updateall v]\nset [x v] to (round (((mouse x) - (MapX)) / ((8) * (4.3))))\nset [y v] to (round (((mouse y) - (MapY)) / ((8) * (4.3))))\nif <[1] = [1]> then\n    delete this clone\nend\nDeleteAttacks\nFormAttacks\n\nwhen I receive [costumeeverything v]\nif <(item (AttackNo.) of [attacktype v]) = [1]> then\n    if <(item (AttackNo.) of [attackstate v]) = [0]> then\n        switch costume to (([floor v] of (((GlobalCostumeNo.) * (2.4)) mod (4)) ) + (1))\n    else\n        switch costume to (([floor v] of (item (AttackNo.) of [attackstate v]) ) + (4))\n    end\nend\nif <(item (AttackNo.) of [attacktype v]) = [2]> then\n    switch costume to (8 v)\nend\nif <(item (AttackNo.) of [attacktype v]) = [3]> then\n    switch costume to (9 v)\nend\nif <(item (AttackNo.) of [attacktype v]) = [4]> then\n    switch costume to (10 v)\n    if <(([floor v] of ((GlobalCostumeNo.) * (12)) ) mod (3)) = [1]> then\n        hide\n    end\nend\nif <(item (AttackNo.) of [attacktype v]) = [5]> then\n    switch costume to (([floor v] of (((GlobalCostumeNo.) * (2.4)) mod (2)) ) + (11))\nend\nif <(item (AttackNo.) of [attacktype v]) = [6]> then\n    switch costume to (([floor v] of (((GlobalCostumeNo.) * (2.4)) mod (4)) ) + (1))\nend\nif <(item (AttackNo.) of [attacktype v]) = [7]> then\n    switch costume to (13 v)\nend\nif <(item (AttackNo.) of [attacktype v]) = [8]> then\n    switch costume to (([floor v] of (((GlobalCostumeNo.) * (4)) mod (4)) ) + (14))\nend\n\nwhen I start as a clone\nswitch costume to (hitbox v)\nif <(item (AttackNo.) of [attacktype v]) = [1]> then\n    if <(item (AttackNo.) of [attackstate v]) = [0]> then\n        if <<touching (levels v)?> or <<touching (enemies v)?> or <<touching (blocks v)?> or <touching (enemyattacks v)?>>>> then\n            if <<touching (enemies v)?> or <<touching (blocks v)?> or <touching (enemyattacks v)?>>> then\n                set [attackx v] to (x position)\n                set [attacky v] to (y position)\n                set [attackdir v] to (direction)\n                broadcast (AttackHit v)\n            else\n                start sound [1C v]\n            end\n            replace item (AttackNo.) of [attackstate v] with [1]\n        end\n        move (12) steps\n        if <([abs v] of (x position) ) > [240]> then\n            add (AttackNo.) to [deleteattacks v]\n        end\n        replace item (AttackNo.) of [attackx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n        replace item (AttackNo.) of [attacky v] with (((y position) - (MapY)) / ((8) * (4.3)))\n    else\n        replace item (AttackNo.) of [attackstate v] with ((item (AttackNo.) of [attackstate v]) + (0.3))\n        if <(item (AttackNo.) of [attackstate v]) > [3.99]> then\n            add (AttackNo.) to [deleteattacks v]\n            hide\n        end\n    end\nend\nif <(item (AttackNo.) of [attacktype v]) = [2]> then\n    move (((4) - (item (AttackNo.) of [attackstate v])) * (2.5)) steps\n    if <<touching (enemies v)?> or <<touching (enemyattacks v)?> or <touching (blocks v)?>>> then\n        set [attackx v] to (x position)\n        set [attacky v] to (y position)\n        set [attackdir v] to (direction)\n        broadcast (AttackHit v)\n        if <touching (enemies v)?> then\n            add (AttackNo.) to [deleteattacks v]\n        end\n    else\n        replace item (AttackNo.) of [attackx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n        replace item (AttackNo.) of [attacky v] with (((y position) - (MapY)) / ((8) * (4.3)))\n        replace item (AttackNo.) of [attackstate v] with ((item (AttackNo.) of [attackstate v]) + (0.3))\n        if <(item (AttackNo.) of [attackstate v]) > [3.99]> then\n            add (AttackNo.) to [deleteattacks v]\n            hide\n        end\n    end\nend\nif <(item (AttackNo.) of [attacktype v]) = [3]> then\n    change y by (-9)\n    change x by (([direction v] of [player v]) / (-30))\n    point towards (player v)\n    change x by (([direction v] of [player v]) / (30))\n    change y by (9)\n    move ((((120) - (distance to [player v])) / (16)) + (2)) steps\n    if <<<(distance to [player v]) < [26]> or <(distance to [player v]) > [135]>> or <(Sucking) = [0]>> then\n        hide\n        add (AttackNo.) to [deleteattacks v]\n    end\n    replace item (AttackNo.) of [attackx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n    replace item (AttackNo.) of [attacky v] with (((y position) - (MapY)) / ((8) * (4.3)))\nend\nif <(item (AttackNo.) of [attacktype v]) = [4]> then\n    go to (player v)\n    move ((28) + ((item (AttackNo.) of [attackstate v]) * (24))) steps\n    if <(item (AttackNo.) of [attackdir v]) > [0]> then\n        turn right (7) degrees\n    else\n        turn left (7) degrees\n    end\n    if <<touching (enemies v)?> or <<touching (enemyattacks v)?> or <touching (blocks v)?>>> then\n        set [attackx v] to (x position)\n        set [attacky v] to (y position)\n        set [attackdir v] to (direction)\n        broadcast (AttackHit v)\n    end\n    replace item (AttackNo.) of [attackdir v] with (direction)\n    if <([abs v] of (direction) ) > [160]> then\n        add (AttackNo.) to [deleteattacks v]\n        delete this clone\n    end\nend\nif <(item (AttackNo.) of [attacktype v]) = [5]> then\n    if <not <([abs v] of (direction) ) = [90]>> then\n        set rotation style [all around v]\n    end\n    move (((4) - (item (AttackNo.) of [attackstate v])) * (2.5)) steps\n    if <touching (enemies v)?> then\n        set [attackx v] to (x position)\n        set [attacky v] to (y position)\n        set [attackdir v] to (direction)\n        broadcast (AttackHit v)\n        add (AttackNo.) to [deleteattacks v]\n    else\n        replace item (AttackNo.) of [attackx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n        replace item (AttackNo.) of [attacky v] with (((y position) - (MapY)) / ((8) * (4.3)))\n        replace item (AttackNo.) of [attackstate v] with ((item (AttackNo.) of [attackstate v]) + (0.3))\n        if <(item (AttackNo.) of [attackstate v]) > [3.99]> then\n            add (AttackNo.) to [deleteattacks v]\n            hide\n        end\n    end\nend\nif <(item (AttackNo.) of [attacktype v]) = [6]> then\n    if <<(Sucking) = [1]> and <<(distance to [player v]) < [120]> and <<<([direction v] of [player v]) = [90]> and <(x position) > ([x position v] of [player v])>> or <<([direction v] of [player v]) = [-90]> and <([x position v] of [player v]) > (x position)>>>>> then\n        change y by (-8)\n        point towards (player v)\n        change y by (8)\n        move ((((120) - (distance to [player v])) / (16)) + (2)) steps\n        if <(distance to [player v]) < [24]> then\n            hide\n            set [sucking v] to [0]\n            set [allowshot v] to [0]\n            set [holding v] to [1]\n            set [holdingtype v] to (item (AttackNo.) of [attackstate v])\n            add (AttackNo.) to [deleteattacks v]\n        end\n    else\n        switch costume to (hitbox v)\n        move (3) steps\n        change y by (([cos v] of (direction) ) * (10))\n        if <(direction) > [0]> then\n            turn right (3) degrees\n            if <(direction) > [135]> then\n                point in direction (135)\n            end\n        else\n            turn left (3) degrees\n            if <(direction) < [-135]> then\n                point in direction (-135)\n            end\n        end\n        if <<<touching (levels v)?> or <([abs v] of (x position) ) > [230]>> or <<touching (semisolids v)?> and <([abs v] of (direction) ) > [90]>>> then\n            move (-5) steps\n            if <([abs v] of (direction) ) > [90]> then\n                point in direction ((180) - (direction))\n            else\n                point in direction ((direction) * (-1))\n            end\n            move (5) steps\n            if <(direction) > [0]> then\n                turn right (5) degrees\n            else\n                turn left (5) degrees\n            end\n        end\n    end\n    replace item (AttackNo.) of [attackx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n    replace item (AttackNo.) of [attacky v] with (((y position) - (MapY)) / ((8) * (4.3)))\n    replace item (AttackNo.) of [attackdir v] with (direction)\nend\nif <(item (AttackNo.) of [attacktype v]) = [7]> then\n    move ((8) - ((item (AttackNo.) of [attackstate v]) * (4))) steps\n    if <<touching (enemies v)?> or <<touching (enemyattacks v)?> or <touching (blocks v)?>>> then\n        set [attackx v] to (x position)\n        set [attacky v] to (y position)\n        set [attackdir v] to (direction)\n        broadcast (AttackHit v)\n        if <touching (enemies v)?> then\n            add (AttackNo.) to [deleteattacks v]\n        end\n    end\n    replace item (AttackNo.) of [attackstate v] with ((item (AttackNo.) of [attackstate v]) + (0.1))\n    if <(item (AttackNo.) of [attackstate v]) > [1]> then\n        add (AttackNo.) to [deleteattacks v]\n        hide\n    end\n    replace item (AttackNo.) of [attackx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n    replace item (AttackNo.) of [attacky v] with (((y position) - (MapY)) / ((8) * (4.3)))\nend\nif <(item (AttackNo.) of [attacktype v]) = [8]> then\n    move ((10) - ((item (AttackNo.) of [attackstate v]) * (5))) steps\n    if <<touching (enemies v)?> or <<touching (enemyattacks v)?> or <touching (blocks v)?>>> then\n        set [attackx v] to (x position)\n        set [attacky v] to (y position)\n        set [attackdir v] to (direction)\n        broadcast (AttackHit v)\n        if <touching (enemies v)?> then\n            add (AttackNo.) to [deleteattacks v]\n        end\n    end\n    replace item (AttackNo.) of [attackstate v] with ((item (AttackNo.) of [attackstate v]) + (0.1))\n    if <(item (AttackNo.) of [attackstate v]) > [1]> then\n        add (AttackNo.) to [deleteattacks v]\n        hide\n    end\n    replace item (AttackNo.) of [attackx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n    replace item (AttackNo.) of [attacky v] with (((y position) - (MapY)) / ((8) * (4.3)))\nend\n\ndefine DeleteAttacks\nrepeat until <(length of [deleteattacks v]) = [0]>\n    if <<(round (item (item (1) of [deleteattacks v]) of [attacktype v])) = [4]> or <(round (item (item (1) of [deleteattacks v]) of [attacktype v])) = [5]>> then\n        broadcast (AttackEnd v)\n    end\n    delete (item (1) of [deleteattacks v]) of [attackx v]\n    delete (item (1) of [deleteattacks v]) of [attacky v]\n    delete (item (1) of [deleteattacks v]) of [attacktype v]\n    delete (item (1) of [deleteattacks v]) of [attackdir v]\n    delete (item (1) of [deleteattacks v]) of [attackstate v]\n    delete (1) of [deleteattacks v]\nend\n\nwhen I receive [newability v]\ngo to [front v] layer\ngo [backward v] (1) layers\nwait (2) seconds\ngo [backward v] (8) layers\n\nwhen I receive [loadstuff v]\ndelete all of [attacktype v]\ndelete all of [attackx v]\ndelete all of [attacky v]\ndelete all of [attackdir v]\ndelete all of [attackstate v]\ndelete all of [deleteattacks v]\n\n@EnemyAttacks\n\nwhen flag clicked\nset rotation style [left-right v]\nset size to (430) %\n\ndefine FormAttacks\nshow\nset [attackno. v] to [0]\nrepeat (length of [enemyattackx v])\n    change [attackno. v] by (1)\n    go to x: (((item (AttackNo.) of [enemyattackx v]) * ((8) * (4.3))) + (MapX)) y: (((item (AttackNo.) of [enemyattacky v]) * ((8) * (4.3))) + (MapY))\n    if <<([abs v] of (x position) ) < [238]> and <([abs v] of (y position) ) < [178]>> then\n        point in direction (item (AttackNo.) of [enemyattackdir v])\n        create clone of (_myself_ v)\n    else\n        add (AttackNo.) to [deleteenemyattack v]\n    end\nend\nchange [attackno. v] by (1)\nhide\n\nwhen I receive [updateall v]\nif <[1] = [1]> then\n    delete this clone\nend\nDeleteAttacks\nFormAttacks\n\nwhen I receive [costumeeverything v]\nset rotation style [left-right v]\nclear graphic effects\nif <(item (AttackNo.) of [enemyattacktype v]) = [1]> then\n    switch costume to (1 v)\n    if <(([floor v] of ((GlobalCostumeNo.) * (4)) ) mod (2)) = [1]> then\n        set [brightness v] effect to (25)\n    end\nend\nif <(item (AttackNo.) of [enemyattacktype v]) = [2]> then\n    switch costume to (2 v)\n    if <(item (AttackNo.) of [enemyattackstate v]) > [4]> then\n        switch costume to (3 v)\n        if <(item (AttackNo.) of [enemyattackstate v]) > [12]> then\n            switch costume to (4 v)\n            if <(item (AttackNo.) of [enemyattackstate v]) > [13]> then\n                switch costume to (5 v)\n                if <(item (AttackNo.) of [enemyattackstate v]) > [13.5]> then\n                    switch costume to (6 v)\n                    if <<touching (player v)?> and <(AllowPlayerDamage) = [1]>> then\n                        broadcast (TakeDamage v)\n                    end\n                    if <(item (AttackNo.) of [enemyattackstate v]) > [14]> then\n                        switch costume to (7 v)\n                    end\n                end\n            end\n        end\n    end\nend\nif <(item (AttackNo.) of [enemyattacktype v]) = [4]> then\n    switch costume to ((([floor v] of ((GlobalCostumeNo.) * (4)) ) mod (4)) + (9))\nend\nif <(item (AttackNo.) of [enemyattacktype v]) = [3]> then\n    switch costume to (8 v)\nend\nif <(item (AttackNo.) of [enemyattacktype v]) = [5]> then\n    set rotation style [all around v]\n    point in direction ((([floor v] of ((GlobalCostumeNo.) * (4)) ) mod (4)) * (90))\nend\n\nwhen I start as a clone\nif <(item (AttackNo.) of [enemyattacktype v]) = [1]> then\n    move ((28) + ((item (AttackNo.) of [enemyattackstate v]) * (24))) steps\n    if <(item (AttackNo.) of [enemyattackdir v]) > [0]> then\n        turn right (4) degrees\n    else\n        turn left (4) degrees\n    end\n    replace item (AttackNo.) of [enemyattackdir v] with (direction)\n    if <<([abs v] of (direction) ) > [160]> or <([abs v] of (x position) ) > [230]>> then\n        add (AttackNo.) to [deleteenemyattack v]\n    end\n    if <<touching (player v)?> and <(AllowPlayerDamage) = [1]>> then\n        broadcast (TakeDamage v)\n    end\nend\nif <(item (AttackNo.) of [enemyattacktype v]) = [2]> then\n    if <<<(Sucking) = [1]> and <(item (AttackNo.) of [enemyattacktype v]) = [2]>> and <<(distance to [player v]) < [120]> and <<<([direction v] of [player v]) = [90]> and <(x position) > ([x position v] of [player v])>> or <<([direction v] of [player v]) = [-90]> and <([x position v] of [player v]) > (x position)>>>>> then\n        change y by (-8)\n        point towards (player v)\n        change y by (8)\n        move ((((120) - (distance to [player v])) / (16)) + (2)) steps\n        if <(distance to [player v]) < [24]> then\n            hide\n            set [sucking v] to [0]\n            set [allowshot v] to [0]\n            set [holding v] to [1]\n            set [holdingtype v] to [None]\n            add (AttackNo.) to [deleteenemyattack v]\n        end\n    else\n        if <(item (AttackNo.) of [enemyattackstate v]) = [0]> then\n            change y by (Gravity)\n            if <(direction) > [0]> then\n                turn right (3) degrees\n                if <(direction) > [135]> then\n                    point in direction (135)\n                end\n            else\n                turn left (3) degrees\n                if <(direction) < [-135]> then\n                    point in direction (-135)\n                end\n            end\n            move (6) steps\n            change y by (([cos v] of (direction) ) * (6))\n            replace item (AttackNo.) of [enemyattackdir v] with (direction)\n            if <touching (levels v)?> then\n                BackUp\n                replace item (AttackNo.) of [enemyattackstate v] with [1]\n            end\n        end\n        if <(item (AttackNo.) of [enemyattackstate v]) > [0]> then\n            replace item (AttackNo.) of [enemyattackstate v] with ((item (AttackNo.) of [enemyattackstate v]) + (0.1))\n            change y by (Gravity)\n            if <touching (levels v)?> then\n                BackUp\n            end\n            if <(item (AttackNo.) of [enemyattackstate v]) > [14.5]> then\n                start sound [1C v]\n                add (AttackNo.) to [deleteenemyattack v]\n                hide\n            end\n        end\n    end\n    replace item (AttackNo.) of [enemyattackx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n    replace item (AttackNo.) of [enemyattacky v] with (((y position) - (MapY)) / ((8) * (4.3)))\nend\nif <(item (AttackNo.) of [enemyattacktype v]) = [3]> then\n    move ((6) - ((item (AttackNo.) of [enemyattackstate v]) * (3))) steps\n    if <<touching (player v)?> and <(AllowPlayerDamage) = [1]>> then\n        broadcast (TakeDamage v)\n    end\n    replace item (AttackNo.) of [enemyattackstate v] with ((item (AttackNo.) of [enemyattackstate v]) + (0.1))\n    if <(item (AttackNo.) of [enemyattackstate v]) > [1]> then\n        add (AttackNo.) to [deleteenemyattack v]\n        hide\n    end\n    replace item (AttackNo.) of [enemyattackx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n    replace item (AttackNo.) of [enemyattacky v] with (((y position) - (MapY)) / ((8) * (4.3)))\nend\nif <(item (AttackNo.) of [enemyattacktype v]) = [4]> then\n    move ((8) - ((item (AttackNo.) of [enemyattackstate v]) * (4))) steps\n    if <<touching (player v)?> and <(AllowPlayerDamage) = [1]>> then\n        broadcast (TakeDamage v)\n    end\n    replace item (AttackNo.) of [enemyattackstate v] with ((item (AttackNo.) of [enemyattackstate v]) + (0.1))\n    if <(item (AttackNo.) of [enemyattackstate v]) > [1]> then\n        add (AttackNo.) to [deleteenemyattack v]\n        hide\n    end\n    replace item (AttackNo.) of [enemyattackx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n    replace item (AttackNo.) of [enemyattacky v] with (((y position) - (MapY)) / ((8) * (4.3)))\nend\nif <(item (AttackNo.) of [enemyattacktype v]) = [5]> then\n    switch costume to (13 v)\n    move (6) steps\n    if <<touching (player v)?> and <(AllowPlayerDamage) = [1]>> then\n        broadcast (TakeDamage v)\n    end\n    replace item (AttackNo.) of [enemyattackx v] with (((x position) - (MapX)) / ((8) * (4.3)))\n    replace item (AttackNo.) of [enemyattacky v] with (((y position) - (MapY)) / ((8) * (4.3)))\n    if <<not <<([abs v] of (x position) ) < [238]> and <([abs v] of (y position) ) < [178]>>> or <touching (levels v)?>> then\n        switch costume to (14 v)\n        add (AttackNo.) to [deleteenemyattack v]\n    end\nend\n\ndefine DeleteAttacks\nrepeat until <(length of [deleteenemyattack v]) = [0]>\n    delete (item (1) of [deleteenemyattack v]) of [enemyattackx v]\n    delete (item (1) of [deleteenemyattack v]) of [enemyattacky v]\n    delete (item (1) of [deleteenemyattack v]) of [enemyattacktype v]\n    delete (item (1) of [deleteenemyattack v]) of [enemyattackdir v]\n    delete (item (1) of [deleteenemyattack v]) of [enemyattackstate v]\n    delete (1) of [deleteenemyattack v]\nend\n\ndefine BackUp\nrepeat until <not <touching (levels v)?>>\n    change y by (1)\nend\n\nwhen I receive [attackhit v]\nif <(item (AttackNo.) of [enemyattacktype v]) = [2]> then\n    if <<([abs v] of ((AttackX) - (x position)) ) < [56]> and <([abs v] of ((AttackY) - (y position)) ) < [56]>> then\n        start sound [1C v]\n        switch costume to (7 v)\n        wait (0) seconds\n        add (AttackNo.) to [deleteenemyattack v]\n    end\nend\n\nwhen I receive [loadstuff v]\ndelete all of [enemyattacktype v]\ndelete all of [enemyattackx v]\ndelete all of [enemyattacky v]\ndelete all of [enemyattackdir v]\ndelete all of [enemyattackstate v]\ndelete all of [deleteenemyattack v]\n\n@Overlay\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo [backward v] (1) layers\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nwait (1) seconds\nset volume to (100) %\nstart sound [Start v]\nswitch costume to (costume3 v)\nset size to (300) %\nswitch costume to (costume2 v)\nwait (2) seconds\nset size to (100) %\nswitch costume to (costume1 v)\nwait (2) seconds\nrepeat (5)\n    change [ghost v] effect by (20)\nend\nhide\nclear graphic effects\n\nwhen I receive [door v]\nswitch costume to (costume1 v)\ngo to [front v] layer\nshow\nset [allowmovement v] to [0]\nset [xvel v] to [0]\nset [yvel v] to [0]\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (0.5) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nclear graphic effects\nhide\nset [allowmovement v] to [1]\n\nwhen I receive [newability v]\nwait until <(Swallowing) = [0]>\nswitch costume to (costume1 v)\nshow\nset [ghost v] effect to (100)\nrepeat (4)\n    change [ghost v] effect by (-15)\nend\nwait (0.8) seconds\nrepeat (4)\n    change [ghost v] effect by (15)\nend\nclear graphic effects\nhide\n\nwhen I receive [death v]\nwait (2.4) seconds\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (0.5) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nclear graphic effects\nhide\n\nwhen I receive [gameend v]\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\ngo to [front v] layer\nshow\nset [allowmovement v] to [0]\nset [xvel v] to [0]\nset [yvel v] to [0]\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nchange [doorspassed v] by (1)\nwait (1) seconds\nstop all sounds\nset volume to (0) %\nstart sound [Ending v]\nrepeat (30)\n    change volume by ((100) / (30))\nend\nset volume to (100) %\nwait (1) seconds\nreset timer\nset [brightness v] effect to (-100)\nswitch costume to (costume3 v)\nset size to (300) %\nswitch costume to (costume4 v)\ngo to x: (0) y: (12)\nrepeat (10)\n    change [brightness v] effect by (10)\nend\nclear graphic effects\nwait (8.33) seconds\nrepeat ((74) * (30))\n    switch costume to (costume3 v)\n    set size to (300) %\n    switch costume to (costume4 v)\n    set y to ([abs v] of (([sin v] of ((((timer) / (60)) * (90)) * (90)) ) * (24)) )\n    set x to (([cos v] of ((((timer) / (60)) * (90)) * (90)) ) * (24))\n    set [fisheye v] effect to (0)\n    if <([abs v] of (([sin v] of ((((timer) / (60)) * (90)) * (90)) ) * (24)) ) < [2]> then\n        set [fisheye v] effect to (3)\n    end\nend\nrepeat (50)\n    switch costume to (costume3 v)\n    set size to (300) %\n    switch costume to (costume4 v)\n    set y to ([abs v] of (([sin v] of ((((timer) / (60)) * (90)) * (90)) ) * (24)) )\n    set x to (([cos v] of ((((timer) / (60)) * (90)) * (90)) ) * (24))\n    set [fisheye v] effect to (0)\n    if <([abs v] of (([sin v] of ((((timer) / (60)) * (90)) * (90)) ) * (24)) ) < [2]> then\n        set [fisheye v] effect to (3)\n    end\n    change [brightness v] effect by (-2)\nend\nswitch costume to (costume1 v)\nstop [all v]\n\n@Water\n\nwhen flag clicked\nset [ghost v] effect to (50)\nset [cloneno. v] to [1]\ncreate clone of (_myself_ v)\nset [cloneno. v] to [0]\n\nwhen I receive [updateall v]\nshow\nswitch costume to (sizebypass v)\nset size to (430) %\nif <(CloneNo.) = [1]> then\n    switch costume to (join [LevelB] (Level))\nelse\n    switch costume to (join [LevelA] (Level))\nend\nif <touching (player v)?> then\n    set [swimming v] to [1]\nend\ngo to x: ((MapX) + ((CloneNo.) * (2064))) y: (MapY)\nif <([abs v] of ((MapX) + ((CloneNo.) * (2064))) ) > [1270]> then\n    hide\nend\n\nwhen I receive [newability v]\nwait (1) seconds\ngo to [front v] layer\ngo [backward v] (6) layers\n\n@Border\n\n@Star\n\nwhen I receive [updateall v]\ngo to [front v] layer\nset size to (500) %\nshow\nif <<(Level) = [2]> and <<(DoorsPassed) = [0]> and <(StarTouched) = [0]>>> then\n    go to x: (((27) * ((8) * (4.3))) + (MapX)) y: (((10.5) * ((8) * (4.3))) + (MapY))\n    if <not <(x position) = (((27) * ((8) * (4.3))) + (MapX))>> then\n        hide\n    end\n    if <<touching (player v)?> and <(StarTouched) = [0]>> then\n        set [startouched v] to [1]\n        broadcast (Flight v)\n        hide\n    end\nelse\n    hide\nend\nswitch costume to ((((GlobalCostumeNo.) * (2)) mod (4)) + (1))\n\nwhen flag clicked\nhide\nset [startouched v] to [0]\n\nwhen I receive [flight v]\nwait (0.5) seconds\nstart sound [08 v]\n\n@Blocks\n\nwhen flag clicked\nset rotation style [left-right v]\nset size to (430) %\n\ndefine FormBlocks\nshow\nset [attackno. v] to [0]\nrepeat (length of [blockx v])\n    change [attackno. v] by (1)\n    go to x: (((item (AttackNo.) of [blockx v]) * ((8) * (4.3))) + (MapX)) y: (((item (AttackNo.) of [blocky v]) * ((8) * (4.3))) + (MapY))\n    if <<([abs v] of (x position) ) < [240]> and <([abs v] of (y position) ) < [178]>> then\n        create clone of (_myself_ v)\n    end\nend\nchange [attackno. v] by (1)\nhide\n\nwhen I receive [updatemap v]\nif <[1] = [1]> then\n    delete this clone\nend\nFormBlocks\n\nwhen I receive [attackhit v]\nif <<([abs v] of ((AttackX) - (x position)) ) < [56]> and <([abs v] of ((AttackY) - (y position)) ) < [56]>> then\n    start sound [1C v]\n    switch costume to (i v)\n    wait (0) seconds\n    delete (AttackNo.) of [blockx v]\n    delete (AttackNo.) of [blocky v]\nend\n\nwhen I receive [loadstuff v]\ndelete all of [blockx v]\ndelete all of [blocky v]\nif <(Level) = [2]> then\n    add [-15] to [blockx v]\n    add [10.35] to [blocky v]\n    add [22] to [blockx v]\n    add [11.35] to [blocky v]\nend\n\n@Health\n\nwhen I receive [costumeeverything v]\nshow\nif <[1] = [1]> then\n    delete this clone\nend\ngo to [front v] layer\ngo [backward v] (3) layers\nFormation\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nset size to (430) %\ngo to [front v] layer\ngo [backward v] (3) layers\n\ndefine Formation\nswitch costume to (3 v)\nset [cloneno. v] to [0]\ngo to x: (-100) y: (-160)\nrepeat (5)\n    change [cloneno. v] by (1)\n    create clone of (_myself_ v)\n    change x by (20)\nend\ngo to x: (-225) y: (-160)\nswitch costume to (health v)\ncreate clone of (_myself_ v)\nhide\n\nwhen I start as a clone\nif <(costume [name v]) = [3]> then\n    if <<(Health) < (CloneNo.)> or <(Dead) = [1]>> then\n        switch costume to (3 v)\n    else\n        switch costume to ((([floor v] of ((GlobalCostumeNo.) * (1)) ) mod (2)) + (2))\n    end\nend\n\n@Thumnail\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\ngo to [front v] layer\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nset [ghost v] effect to (100)\n\n
Halloween 2 || A Platformer\nFull Screen Recommended\n\nHalloween 3:\nhttps://scratch.mit.edu/projects/582523653/\n\nHalloween 1: https://scratch.mit.edu/projects/580373643\n\nReleased on 9th of October\n#4 on trending! (13th of October)\nWhat the community is loving! (13th of October)\n\n--How To Play--\n- Use Arrow Keys, WASD or Touch (mobile)\n- Collect All Treats before Completing a Level\n- Avoid Spikes, Lava and Falling off a clift\n- Touching Trampolines make you bounce!\n- You Can Swim in Water!\n\nPlease Do Not Advertise\n\n--Goals--\n50 Likes (Complete!!)\n100 Likes (Complete!!)\n1000 Likes (Complete!!!!!!!!!!!!!!!!!!!!!)\n\n--Languages--\n- Halloween 2 || A Platformer\n- ハロウィーン2 ||プラットフォーマー\n\n--Tags--\n#all #games #platformers #music #halloween #games #animations #art #all #all #all #all #all #all #games #trending #trending #games #games #games #games #games #games #games #platformer #platformers #mobile #friendly #all #games #games #stories #all #all #all\n\n--Credits--\n@-CodingAnimations- for the Contest\n@griffpatch for the physics\n@-duxx for the intro\n@jindalsargun for art\nGeometry Dash Orbs\nKevin MacLeod for The Music "Not As it Seems"