Journal 2  [A platformer] 
@Stage\n\nwhen flag clicked\nbroadcast (Menu v)\nforever\n    change [_sine v] by (1)\n    if <(_SINE) > [179]> then\n        set [_sine v] to [0]\n    end\n    broadcast (Pre-Tick v)\n    broadcast (Tick v)\n    broadcast (Post-Tick v)\n    broadcast (Position v)\nend\n\nwhen I receive [post-tick v]\nif <(_LEVEL) = [X]> then\n    if <<([p_myx v] of [player v]) < [400]> and <<([p_myy v] of [player v]) > [550]> and <([p_myy v] of [player v]) < [1000]>>> then\n        Elastic Camera [200] [750] [2] [2]\n    else\n        Neutral Camera\n    end\n    X Limits [30] [850]\n    Y Limits [50] [4000]\nelse\n    if <(_LEVEL) = [Z]> then\n        Neutral Camera\n        X Limits [50] [50]\n        Y Limits [50] [2000]\n    else\n        if <(_LEVEL) = [1]> then\n            Level 1 Cameras\n        else\n            if <(_LEVEL) = [2]> then\n                Neutral Camera\n            end\n        end\n    end\nend\n\ndefine Smooth Camera (x) (y) (speed)\nset [_camera x v] to (round ((_CAMERA X) - (((_CAMERA X) - (x)) / (speed))))\nset [_camera y v] to (round ((_CAMERA Y) - (((_CAMERA Y) - (y)) / (speed))))\n\ndefine X Limits (min) (max)\nif <(_CAMERA X) < (min)> then\n    set [_camera x v] to (min)\nend\nif <(_CAMERA X) > (max)> then\n    set [_camera x v] to (max)\nend\n\ndefine Y Limits (min) (max)\nif <(_CAMERA Y) < (min)> then\n    set [_camera y v] to (min)\nend\nif <(_CAMERA Y) > (max)> then\n    set [_camera y v] to (max)\nend\n\nwhen I receive [load level v]\nset [_camera x v] to ([p_myx v] of [player v])\nset [_camera y v] to ([p_myy v] of [player v])\nswitch backdrop to (join [Level_] (_LEVEL))\n\ndefine Neutral Camera\nif <([a_direction v] of [player v]) = [90]> then\n    Smooth Camera (([p_myx v] of [player v]) + (10)) ((([p_myy v] of [player v]) + (([p_yspd v] of [player v]) / (2))) + (10)) [4]\nend\nif <([a_direction v] of [player v]) = [-90]> then\n    Smooth Camera (([p_myx v] of [player v]) - (10)) ((([p_myy v] of [player v]) + (([p_yspd v] of [player v]) / (2))) + (10)) [4]\nend\n\ndefine Elastic Camera (x) (y) (xelasticity) (yelasticity)\nSmooth Camera ((x) + ((([p_myx v] of [player v]) - (x)) / (xelasticity))) ((y) + ((([p_myy v] of [player v]) - (y)) / (yelasticity))) [4]\n\ndefine Level 1 Cameras\nif <([p_myx v] of [player v]) < [-1900]> then\n    Elastic Camera [-2100] [-430] [2] [10]\nelse\n    if <<([p_myx v] of [player v]) > [-1901]> and <([p_myx v] of [player v]) < [-1500]>> then\n        Elastic Camera [-1600] [-400] [2] [4]\n    else\n        if <<([p_myx v] of [player v]) > [-1501]> and <([p_myx v] of [player v]) < [-1100]>> then\n            Elastic Camera [-1100] [-300] [2] [2]\n        else\n            if <<([p_myx v] of [player v]) > [-1101]> and <([p_myx v] of [player v]) < [-700]>> then\n                Elastic Camera [-800] [-200] [2] [3]\n            else\n                if <<([p_myx v] of [player v]) > [-701]> and <([p_myx v] of [player v]) < [-100]>> then\n                    Elastic Camera [-250] [-100] [2] [3]\n                else\n                    if <<([p_myx v] of [player v]) > [-101]> and <([p_myx v] of [player v]) < [220]>> then\n                        Elastic Camera [100] [100] [4] [3]\n                    else\n                        if <<([p_myx v] of [player v]) > [219]> and <([p_myx v] of [player v]) < [750]>> then\n                            Elastic Camera [520] [310] [4] [8]\n                        else\n                            if <<([p_myx v] of [player v]) > [749]> and <([p_myx v] of [player v]) < [1400]>> then\n                                Elastic Camera [1100] [280] [1.5] [10]\n                            else\n                                if <<([p_myx v] of [player v]) > [1399]> and <([p_myx v] of [player v]) < [1800]>> then\n                                    Elastic Camera [1600] [300] [3] [4]\n                                else\n                                    if <([p_myx v] of [player v]) > [1799]> then\n                                        Elastic Camera [2200] [480] [2] [4]\n                                    else\n                                        Neutral Camera\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nX Limits [-2300] [2200]\nY Limits [-440] [520]\n\nwhen I receive [cutscene v]\nif <(_CUTSCENE) = [1]> then\n    set [_camera x v] to [-2150]\n    set [_camera y v] to [-440]\nend\n\ndefine Load level 1\nset [_game state v] to [1]\nset [_cutscene v] to [1]\nset [_level v] to [1]\nset [_camera x v] to [-2150]\nset [_camera y v] to [-440]\nbroadcast (Initial Setup v) and wait\nbroadcast (Load Level v) and wait\nbroadcast (Pre-Tick v)\nbroadcast (Tick v)\nbroadcast (Post-Tick v)\nbroadcast (Position v)\nbroadcast (Cutscene v) and wait\n\ndefine Load Level X\nset [_game state v] to [0]\nset [_cutscene v] to [0]\nset [_level v] to [X]\nset [_camera x v] to [0]\nset [_camera y v] to [0]\nbroadcast (Load Level v)\n\ndefine Load Level 2\nset [_game state v] to [0]\nset [_cutscene v] to [0]\nset [_level v] to [2]\nset [_camera x v] to [0]\nset [_camera y v] to [0]\nbroadcast (Initial Setup v) and wait\nbroadcast (Load Level v) and wait\nbroadcast (Pre-Tick v)\nbroadcast (Tick v)\nbroadcast (Post-Tick v)\nbroadcast (Position v)\n\nwhen I receive [menu - level v]\nif <(_LEVEL) = [1]> then\n    Load level 1\nelse\n    if <(_LEVEL) = [X]> then\n        Load Level X\n    end\nend\n\n@Player\n\nwhen I receive [tick v]\nif <(_GAME STATE) = [0]> then\n    Platforming\nend\n\ndefine Left - Right (acc) (max speed) <left> <right>\nif <<left> or <right>> then\n    if <(P_Wall stick) = [0]> then\n        if <right> then\n            change [p_xspd v] by (acc)\n            if <(P_Xspd) > (max speed)> then\n                set [p_xspd v] to (max speed)\n            end\n        else\n            change [p_xspd v] by (() - (acc))\n            if <(P_Xspd) < ((0) - (max speed))> then\n                set [p_xspd v] to ((0) - (max speed))\n            end\n        end\n    else\n        if <<left> and <(P_Wall) = [-1]>> then\n            change [p_wall stick v] by (-1)\n        end\n        if <<right> and <(P_Wall) = [1]>> then\n            change [p_wall stick v] by (-1)\n        end\n        if <(P_Wall stick) = [0]> then\n            set [p_wall v] to [0]\n        end\n    end\nelse\n    if <(P_Ground) = [1]> then\n        if <not <(P_Xspd) = [0]>> then\n            if <(P_Xspd) > [0]> then\n                change [p_xspd v] by (() - (acc))\n                if <(P_Xspd) < [0]> then\n                    set [p_xspd v] to [0]\n                end\n            else\n                change [p_xspd v] by (acc)\n                if <(P_Xspd) > [0]> then\n                    set [p_xspd v] to [0]\n                end\n            end\n        end\n    else\n        if <not <(P_Xspd) = [0]>> then\n            if <(P_Xspd) > [0]> then\n                change [p_xspd v] by (() - ((acc) / (4)))\n                if <(P_Xspd) < [0]> then\n                    set [p_xspd v] to [0]\n                end\n            else\n                change [p_xspd v] by ((acc) / (4))\n                if <(P_Xspd) > [0]> then\n                    set [p_xspd v] to [0]\n                end\n            end\n        end\n    end\nend\n\ndefine Change X (xdif) (C)\nset [p_wall v] to [0]\nif <(xdif) > [0]> then\n    repeat ([abs v] of (xdif) )\n        change x by (1)\n        change [p_myx v] by (1)\n        if <touching (collision v)?> then\n            change x by (-1)\n            if <not <touching (non- wall v)?>> then\n                if <(P_Ground) = [0]> then\n                    set [p_wall v] to [-1]\n                    set [p_wall jump v] to [0]\n                    if <(AP_Prev Wall) = [0]> then\n                        set [p_wall stick v] to [8]\n                    end\n                end\n            end\n            change [p_myx v] by (-1)\n            set [p_xspd v] to [0]\n        end\n    end\nelse\n    repeat ([abs v] of (xdif) )\n        change x by (-1)\n        change [p_myx v] by (-1)\n        if <touching (collision v)?> then\n            change x by (1)\n            if <not <touching (non- wall v)?>> then\n                if <(P_Ground) = [0]> then\n                    set [p_wall v] to [1]\n                    set [p_wall jump v] to [0]\n                    if <(AP_Prev Wall) = [0]> then\n                        set [p_wall stick v] to [8]\n                    end\n                end\n            end\n            change [p_myx v] by (1)\n            set [p_xspd v] to [0]\n        end\n    end\nend\n\ndefine Jump (strength) (jumps) <up> (wall jump ticks)\nif <up> then\n    if <(P_Up Pressed?) = [0]> then\n        set [p_up pressed? v] to [1]\n        if <(A_Crouching) = [0]> then\n            if <<not <(P_Wall) = [0]>> or <<(P_Jumps) < (jumps)> and <(P_Ticks) > (ticks req)>>> then\n                set [p_ticks v] to [0]\n                if <(P_Wall) = [0]> then\n                    change [p_jumps v] by (1)\n                    if <(P_Ground) = [1]> then\n                        Effect [1]\n                    else\n                        Effect [3]\n                    end\n                else\n                    set [p_wall stick v] to [0]\n                    set [p_jumps v] to [0]\n                    set [p_wall jump v] to (wall jump ticks)\n                    set [p_xspd v] to ((P_Wall) * (C_Max Speed))\n                    Effect [2]\n                    set [p_wall v] to [0]\n                end\n                if <<(P_Jumps) = [1]> or <not <(P_Wall Jump) = [0]>>> then\n                    start sound [Jump2 v]\n                else\n                    start sound [Flip v]\n                end\n                set [p_yspd v] to (strength)\n            end\n        end\n    end\nelse\n    set [p_up pressed? v] to [0]\nend\n\ndefine Touching ground? <up?> <down>\nset [p_failsafe v] to [0]\nset [p_ground v] to [0]\nif <not <(P_Coyote timing) = [0]>> then\n    change [p_coyote timing v] by (-1)\nend\nrepeat until <<not <touching (collision v)?>> or <(P_Failsafe) > [1000]>>\n    if <up?> then\n        Change Y (-1)\n    else\n        Change Y (1)\n        set [p_jumps v] to [0]\n        set [p_ground v] to [1]\n    end\n    set [p_coyote timing v] to [3]\n    set [p_yspd v] to [0]\n    change [p_failsafe v] by (1)\n    set [p_wall jump v] to [0]\nend\nif <<(P_Platform ticks) = [0]> and <(P_Yspd) < [0]>> then\n    repeat until <<not <touching (platforms v)?>> or <(P_Failsafe) > [1000]>>\n        Change Y (1)\n        set [p_jumps v] to [0]\n        set [p_yspd v] to [0]\n        if <down> then\n            set [p_platform ticks v] to [10]\n        end\n        set [p_coyote timing v] to [3]\n        set [p_ground v] to [1]\n        change [p_failsafe v] by (1)\n    end\nelse\n    if <(P_Platform ticks) > [0]> then\n        change [p_platform ticks v] by (-1)\n    end\nend\nif <(P_Failsafe) > [1000]> then\n    stop [all v]\nend\n\ndefine Direction (direction)\nif <not <(direction) = (direction)>> then\n    point in direction (direction)\nend\n\ndefine Update (gravity) (terminal velocity) (tv 2)\nDirection (90)\nif <(A_Crouching) = [0]> then\n    switch costume to (hitbox v)\nelse\n    switch costume to (crouch hitbox v)\nend\nchange [p_yspd v] by (() - (gravity))\nif <(P_Wall Jump) > [0]> then\n    change [p_wall jump v] by (-1)\nend\nif <(P_Yspd) < ((0) - (terminal velocity))> then\n    set [p_yspd v] to ((0) - (terminal velocity))\nend\nif <not <(P_Wall) = [0]>> then\n    if <(P_Yspd) < ((0) - (tv 2))> then\n        set [p_yspd v] to ((0) - (tv 2))\n    end\nend\n\ndefine Set coustume\nswitch costume to (A_Costume#)\nFace Direction\nif <not <(P_Hit ticks) = [0]>> then\n    switch costume to (join [N_Hit] ((5) - ((P_Hit ticks) / (2))))\nelse\n    if <not <(P_Wall) = [0]>> then\n        Wall Animations\n    else\n        if <(P_Ground) = [1]> then\n            Ground Animations\n        else\n            Air Animations\n        end\n    end\nend\nchange [p_ticks v] by (0.1)\nchange [a_ticks v] by (0.1)\nset [a_costume# v] to (costume [number v])\n\ndefine Change Y (ydif)\nchange y by (ydif)\nchange [p_myy v] by (ydif)\n\nwhen I receive [position v]\nif <(_GAME STATE) = [0]> then\n    switch costume to (move v)\n    go to x: ((P_MyX) - (_CAMERA X)) y: ((P_MyY) - (_CAMERA Y))\n    switch costume to (A_Costume#)\nelse\n    go to x: ((P_MyX) - (_CAMERA X)) y: ((P_MyY) - (_CAMERA Y))\nend\n\ndefine A_Loop (first) (last) (ticks)\nif <<(costume [number v]) < (first)> or <(costume [number v]) > (last)>> then\n    switch costume to (first)\nelse\n    if <(A_Ticks) > (ticks)> then\n        set [a_ticks v] to [0]\n        if <(costume [number v]) = (last)> then\n            switch costume to (first)\n        else\n            next costume\n        end\n    end\nend\n\ndefine A_Animate (first) (last) (ticks)\nif <<(costume [number v]) < (first)> or <(costume [number v]) > (last)>> then\n    switch costume to (first)\n    set [a_animation switch v] to [1]\nelse\n    if <(A_Ticks) > (ticks)> then\n        set [a_ticks v] to [0]\n        if <(A_Animation Switch) = [1]> then\n            next costume\n            if <(costume [number v]) = (last)> then\n                set [a_animation switch v] to [0]\n            end\n        else\n            switch costume to ((costume [number v]) - (1))\n            if <(costume [number v]) = (first)> then\n                set [a_animation switch v] to [1]\n            end\n        end\n    end\nend\n\ndefine Face Direction\nif <(P_Hit ticks) = [0]> then\n    if <not <<(P_Jumps) = [2]> and <(P_Yspd) > [4]>>> then\n        if <(P_Attack Ticks) = [0]> then\n            if <(P_Xspd) = [0]> then\n                if <(C_Pr_Right) = [1]> then\n                    set [a_direction v] to [90]\n                end\n                if <(C_Pr_Left) = [1]> then\n                    set [a_direction v] to [-90]\n                end\n            else\n                set rotation style [left-right v]\n                if <(P_Xspd) > [0]> then\n                    set [a_direction v] to [90]\n                else\n                    set [a_direction v] to [-90]\n                end\n            end\n        end\n    end\n    if <not <(P_Wall) = [0]>> then\n        if <(P_Wall) = [1]> then\n            set [a_direction v] to [-90]\n        else\n            set [a_direction v] to [90]\n        end\n    end\nend\n\ndefine Attack <sword> <star> (a_length) <up>\nif <(P_Attack Ticks) = [0]> then\n    set [p_attack direction v] to [0]\nelse\n    change [p_attack ticks v] by (-1)\n    if <(P_Attack Ticks) = [0]> then\n        set [p_attack direction v] to [0]\n    end\nend\nif <<sword> or <<star> and <(P_Ninja Stars) > [0]>>> then\n    if <(P_Attack Pressed?) = [0]> then\n        if <(P_Attack Ticks) = [0]> then\n            set [p_attack pressed? v] to [1]\n            set [p_attack ticks v] to (a_length)\n            if <<(C_Pr_Down) = [1]> and <(A_Crouching) = [0]>> then\n                set [p_attack direction v] to [2]\n            else\n                if <(C_Pr_Up) = [1]> then\n                    set [p_attack direction v] to [3]\n                else\n                    set [p_attack direction v] to [1]\n                    if <(C_Pr_Left) = [1]> then\n                        set [a_direction v] to [-90]\n                    end\n                    if <(C_Pr_Right) = [1]> then\n                        set [a_direction v] to [90]\n                    end\n                end\n            end\n            if <sword> then\n                set [e_attack type v] to [1]\n                start sound [Swoosh v]\n            else\n                change [p_ninja stars v] by (-1)\n                set [e_attack type v] to [2]\n                set [_hud_star animation v] to [0]\n                start sound [Swoosh v]\n            end\n            broadcast (Attack v)\n        end\n    end\nelse\n    set [p_attack pressed? v] to [0]\nend\n\ndefine Effect (effect #)\nset [e_effect type v] to (effect #)\nbroadcast (Effect v)\n\nwhen I receive [monster hit v]\nif <(E_Attack type) = [1]> then\n    if <(P_Attack Direction) = [2]> then\n        if <(P_Yspd) > [10]> then\n            change [p_yspd v] by (10)\n        else\n            set [p_yspd v] to [20]\n        end\n        set [p_jumps v] to [1]\n    else\n        if <(P_Attack Direction) = [1]> then\n            if <(A_Direction) = [90]> then\n                set [p_xspd v] to [-12]\n            else\n                set [p_xspd v] to [12]\n            end\n        end\n    end\nend\n\ndefine Hit (length)\nif <(P_Invincibility) = [0]> then\n    set [p_hit ticks v] to [10]\n    set [p_yspd v] to [20]\n    set [p_invincibility v] to (length)\n    if <(A_Direction) = [-90]> then\n        set [p_xspd v] to [8]\n    else\n        set [p_xspd v] to [-8]\n    end\n    change [p_health v] by (-1)\n    if <(P_Health) = [0]> then\n        set [_transition type v] to [5]\n        broadcast (Transition v)\n        set [p_health v] to [5]\n        set [p_ninja stars v] to [5]\n    end\nend\n\ndefine Ground Animations\nif <(A_Crouching) = [1]> then\n    if <not <(P_Attack Direction) = [0]>> then\n        if <(E_Attack type) = [1]> then\n            if <(P_Attack Direction) = [3]> then\n                switch costume to (join [NCU_Attack] ((8) - (P_Attack Ticks)))\n            else\n                switch costume to (join [NCR_Attack] ((8) - (P_Attack Ticks)))\n            end\n        else\n            if <(P_Attack Direction) = [3]> then\n                switch costume to (join [NCU_Throw] ((8) - (P_Attack Ticks)))\n            else\n                switch costume to (join [NCR_Throw] ((8) - (P_Attack Ticks)))\n            end\n        end\n    else\n        if <(A_Crouch Position) = [4]> then\n            if <(P_Xspd) = [0]> then\n                A_Animate [30] [33] [0.2]\n            else\n                A_Loop [34] [42] [0.2]\n            end\n            if <<(costume [number v]) = [34]> or <(costume [number v]) = [38]>> then\n                if <(Sound_Step) = [0]> then\n                    set [sound_step v] to [1]\n                    start sound [Step v]\n                end\n            else\n                set [sound_step v] to [0]\n            end\n        else\n            switch costume to (join [N_Crouching] (A_Crouch Position))\n        end\n    end\nelse\n    if <not <(P_Attack Direction) = [0]>> then\n        if <(E_Attack type) = [1]> then\n            if <(P_Attack Direction) = [3]> then\n                switch costume to (join [NGU_Attack] ((8) - (P_Attack Ticks)))\n            else\n                switch costume to (join [NGR_Attack] ((8) - (P_Attack Ticks)))\n            end\n        else\n            if <(P_Attack Direction) = [3]> then\n                switch costume to (join [NGU_Throw] ((8) - (P_Attack Ticks)))\n            else\n                switch costume to (join [NGR_Throw] ((8) - (P_Attack Ticks)))\n            end\n        end\n    else\n        if <not <(A_Land) = [0]>> then\n            switch costume to (join [N_Land] ((6) - (A_Land)))\n        else\n            if <(A_Crouch Position) = [0]> then\n                if <(P_Xspd) = [0]> then\n                    A_Animate [3] [5] [0.2]\n                else\n                    if <([abs v] of (P_Xspd) ) = [16]> then\n                        A_Loop [12] [16] [0]\n                        if <(costume [number v]) = [15]> then\n                            if <(Sound_Step) = [0]> then\n                                set [sound_step v] to [1]\n                                start sound [Step v]\n                            end\n                        else\n                            set [sound_step v] to [0]\n                        end\n                    else\n                        if <<<(C_Pr_Right) = [1]> and <(P_Xspd) < [0]>> or <<(C_Pr_Left) = [1]> and <(P_Xspd) > [0]>>> then\n                            switch costume to (join [N_Turn] (([abs v] of (P_Xspd) ) / (4)))\n                            if <(Sound_Slide) = [0]> then\n                                set [sound_slide v] to [1]\n                                start sound [Turn v]\n                            end\n                            Effect [9]\n                        else\n                            set [sound_slide v] to [0]\n                            switch costume to (join [NS_Run] (([abs v] of (P_Xspd) ) / (4)))\n                            if <(costume [name v]) = [NS_Run1]> then\n                                start sound [Step v]\n                            end\n                        end\n                    end\n                end\n            else\n                switch costume to (join [N_UnCrouching] (A_Crouch Position))\n            end\n        end\n    end\nend\n\ndefine Air Animations\nif <not <(P_Attack Direction) = [0]>> then\n    if <(E_Attack type) = [1]> then\n        if <(P_Attack Direction) = [3]> then\n            switch costume to (join [NAU_Attack] ((8) - (P_Attack Ticks)))\n        else\n            if <(P_Attack Direction) = [2]> then\n                switch costume to (join [NAD_Attack] ((8) - (P_Attack Ticks)))\n            else\n                switch costume to (join [NAR_Attack] ((8) - (P_Attack Ticks)))\n            end\n        end\n    else\n        if <(P_Attack Direction) = [3]> then\n            switch costume to (join [NAU_Throw] ((8) - (P_Attack Ticks)))\n        else\n            if <(P_Attack Direction) = [2]> then\n                switch costume to (join [NAD_Throw] ((8) - (P_Attack Ticks)))\n            else\n                switch costume to (join [NAR_Throw] ((8) - (P_Attack Ticks)))\n            end\n        end\n    end\nelse\n    if <not <(P_Xspd) = [0]>> then\n        if <(P_Yspd) < [-28]> then\n            A_Loop [55] [56] [0.2]\n        else\n            if <(P_Jumps) = [2]> then\n                switch costume to (join [ND_Air] ((10) - (([ceiling v] of (P_Yspd) ) / (2))))\n            else\n                switch costume to (join [NM_Air] ((6) - (([ceiling v] of (P_Yspd) ) / (4))))\n            end\n        end\n    else\n        if <(P_Yspd) < [-28]> then\n            A_Loop [69] [70] [0.2]\n        else\n            switch costume to (join [NS_Air] ((6) - (([ceiling v] of (P_Yspd) ) / (4))))\n        end\n    end\nend\n\nwhen I receive [load level v]\nhide\ngo to x: (0) y: (0)\nSpawn\nset [p_xspd v] to [0]\nset [p_yspd v] to [0]\nset [p_ticks v] to [0]\nset [p_jumps v] to [0]\ngo to x: ((P_MyX) - (_CAMERA X)) y: ((P_MyY) - (_CAMERA Y))\nshow\n\ndefine Level Transition\nif <([transition ticks v] of [overlay v]) = [0]> then\n    if <(_LEVEL) = [X]> then\n        if <(P_MyX) > [1100]> then\n            if <(P_MyY) > [1600]> then\n                Transition [1] [Z] [2]\n            else\n                Transition [1] [Z] [1]\n            end\n        end\n    end\n    if <(_LEVEL) = [Z]> then\n        if <(P_MyX) < [-200]> then\n            if <(P_MyY) > [1800]> then\n                Transition [2] [X] [2]\n            else\n                Transition [2] [X] [1]\n            end\n        end\n    end\n    if <(_LEVEL) = [1]> then\n        if <(P_MyX) > [2450]> then\n            broadcast (Menu v)\n        end\n    end\nend\n\ndefine Transition (transition) (level) (area)\nset [_transition type v] to (transition)\nset [_transitioning level v] to (level)\nset [p_spawn area v] to (area)\nbroadcast (Transition v)\n\ndefine Spawn\nif <(_LEVEL) = [X]> then\n    if <(P_Spawn Area) = [0]> then\n        set [p_myx v] to [0]\n        set [p_myy v] to [0]\n    end\n    if <(P_Spawn Area) = [1]> then\n        set [p_myx v] to [1000]\n        set [p_myy v] to [920]\n    end\n    if <(P_Spawn Area) = [2]> then\n        set [p_myx v] to [1050]\n        set [p_myy v] to [1600]\n    end\nend\nif <(_LEVEL) = [Z]> then\n    if <(P_Spawn Area) = [1]> then\n        set [p_myx v] to [-100]\n        set [p_myy v] to [-50]\n    end\n    if <(P_Spawn Area) = [2]> then\n        set [p_myx v] to [-100]\n        set [p_myy v] to [1980]\n    end\nend\nif <(_LEVEL) = [1]> then\n    if <(P_Spawn Area) = [0]> then\n        set [p_myx v] to [-2150]\n        set [p_myy v] to [-538]\n    end\n    if <(P_Spawn Area) = [2]> then\n        set [p_myx v] to [-100]\n        set [p_myy v] to [1980]\n    end\nend\nif <(_LEVEL) = [2]> then\n    if <(P_Spawn Area) = [0]> then\n        set [p_myx v] to [0]\n        set [p_myy v] to [0]\n    end\n    if <(P_Spawn Area) = [1]> then\n        set [p_myx v] to [0]\n        set [p_myy v] to [0]\n    end\nend\n\nwhen flag clicked\nset size to (100) %\npoint in direction (90)\nset [c_max speed v] to [16]\nset [p_ninja stars v] to [5]\nset [p_health v] to [5]\nset [p_spawn area v] to [0]\nhide\n\ndefine Controls\nset [c_pr_up v] to <<key (up arrow v) pressed?> or <key (w v) pressed?>>\nset [c_pr_down v] to <<key (down arrow v) pressed?> or <key (s v) pressed?>>\nset [c_pr_left v] to <<key (left arrow v) pressed?> or <key (a v) pressed?>>\nset [c_pr_right v] to <<key (right arrow v) pressed?> or <key (d v) pressed?>>\nset [c_pr_jump v] to <<key (space v) pressed?> or <<key (z v) pressed?> or <key (l v) pressed?>>>\nset [c_pr_attack v] to <<key (x v) pressed?> or <key (k v) pressed?>>\nset [c_pr_star v] to <<key (c v) pressed?> or <key (j v) pressed?>>\n\ndefine Wall Animations\nif <not <(P_Attack Direction) = [0]>> then\n    if <(E_Attack type) = [1]> then\n        if <(P_Attack Direction) = [3]> then\n            switch costume to (join [NWU_Attack] ((8) - (P_Attack Ticks)))\n        else\n            if <(P_Attack Direction) = [2]> then\n                switch costume to (join [NWD_Attack] ((8) - (P_Attack Ticks)))\n            else\n                switch costume to (join [NWR_Attack] ((8) - (P_Attack Ticks)))\n            end\n        end\n    else\n        if <(P_Attack Direction) = [3]> then\n            switch costume to (join [NWU_Throw] ((8) - (P_Attack Ticks)))\n        else\n            if <(P_Attack Direction) = [2]> then\n                switch costume to (join [NWD_Throw] ((8) - (P_Attack Ticks)))\n            else\n                switch costume to (join [NWR_Throw] ((8) - (P_Attack Ticks)))\n            end\n        end\n    end\nelse\n    switch costume to (join [NW_Land] ((5) - (A_Wall land)))\n    if <(Sound_Wall Slide) = [0]> then\n        set [sound_wall slide v] to [3]\n        start sound [Wall Slide v]\n    else\n        change [sound_wall slide v] by (-1)\n    end\nend\n\nwhen I receive [player hit v]\nHit [46]\n\ndefine Hit Recovery (ghost loop)\nif <not <(P_Invincibility) = [0]>> then\n    change [p_invincibility v] by (-1)\n    change [p_hit ticks v] by (-1)\n    if <(P_Hit ticks) < [0]> then\n        set [p_hit ticks v] to [0]\n    end\nend\nif <not <(P_Invincibility) = [0]>> then\n    change [a_invincibility ticks v] by (1)\n    if <(A_Invincibility Ticks) > ((ghost loop) / (2))> then\n        set [ghost v] effect to (75)\n        if <(A_Invincibility Ticks) > (ghost loop)> then\n            set [a_invincibility ticks v] to [0]\n        end\n    else\n        set [ghost v] effect to (0)\n    end\nelse\n    set [ghost v] effect to (0)\nend\n\ndefine Touching Wall\nif <<(P_Xspd) = [0]> and <(P_Ground) = [0]>> then\n    change x by (-1)\n    if <touching (collision v)?> then\n        if <not <touching (non- wall v)?>> then\n            set [p_wall v] to [1]\n            set [p_wall jump v] to [0]\n        end\n    end\n    change x by (2)\n    if <touching (collision v)?> then\n        if <not <touching (non- wall v)?>> then\n            set [p_wall v] to [-1]\n            set [p_wall jump v] to [0]\n        end\n    end\n    change x by (-1)\nend\nif <not <(A_Wall land) = [0]>> then\n    change [a_wall land v] by (-1)\nend\nif <<not <(P_Wall) = [0]>> and <(AP_Prev Wall) = [0]>> then\n    set [a_wall land v] to [5]\n    start sound [Land v]\nend\nset [ap_prev wall v] to (P_Wall)\nif <(P_Wall) = [0]> then\n    set [p_wall stick v] to [0]\nend\n\ndefine A_Collision / Crouch\nif <(P_Ground) = [1]> then\n    set [p_wall v] to [0]\nelse\n    if <<(P_Jumps) = [0]> and <(P_Coyote timing) = [0]>> then\n        set [p_jumps v] to [1]\n    end\nend\nif <not <(A_Land) = [0]>> then\n    change [a_land v] by (-1)\nend\nif <<(E_Prev Ground?) = [0]> and <(P_Ground) = [1]>> then\n    Effect [4]\n    start sound [Land v]\n    set [a_land v] to [5]\nend\nset [e_prev ground? v] to (P_Ground)\nif <<(E_Prev wall?) = [0]> and <not <(P_Wall) = [0]>>> then\n    Effect [5]\nend\nset [e_prev wall? v] to (P_Wall)\nif <<not <(P_Wall) = [0]>> and <(P_Yspd) < [0]>> then\n    change [a_wall effect ticks v] by (1)\n    if <(A_Wall Effect ticks) > [2]> then\n        set [a_wall effect ticks v] to [0]\n        Effect [6]\n    end\nend\nif <(P_Ground) = [1]> then\n    if <(C_Pr_Down) = [1]> then\n        set [a_crouching v] to [1]\n    else\n        switch costume to (hitbox v)\n        if <touching (collision v)?> then\n            switch costume to (crouch hitbox v)\n        else\n            set [a_crouching v] to [0]\n        end\n    end\nelse\n    set [a_crouch position v] to [0]\nend\nif <(A_Crouching) = [1]> then\n    change [a_crouch position v] by (1)\n    if <(A_Crouch Position) > [4]> then\n        set [a_crouch position v] to [4]\n    end\nelse\n    change [a_crouch position v] by (-1)\n    if <(A_Crouch Position) < [0]> then\n        set [a_crouch position v] to [0]\n    end\nend\n\nforever\n    go to x: (0) y: (0)\n    show\n    switch costume to (n_stance1 v)\n    repeat (16)\n        wait (0) seconds\n        next costume\n    end\nend\n\ndefine Platforming\nControls\nif <<not <(P_Wall) = [0]>> and <(P_Yspd) < [0]>> then\n    Update [0.5] [60] [8]\nelse\n    Update [2] [60] [8]\n    set [p_yspd v] to ((round ((P_Yspd) / (2))) * (2))\nend\nif <(P_Wall Jump) = [0]> then\n    if <(P_Hit ticks) = [0]> then\n        if <(P_Ground) = [1]> then\n            if <(A_Crouching) = [1]> then\n                Left - Right (4) ((C_Max Speed) / (3)) <(C_Pr_Left) = [1]> <(C_Pr_Right) = [1]>\n            else\n                Left - Right (4) (C_Max Speed) <(C_Pr_Left) = [1]> <(C_Pr_Right) = [1]>\n            end\n        else\n            Left - Right (2) (C_Max Speed) <(C_Pr_Left) = [1]> <(C_Pr_Right) = [1]>\n        end\n    end\nend\nChange X (P_Xspd) (C)\nTouching Wall\nJump (20) (2) <(C_Pr_Jump) = [1]> [4]\nChange Y (P_Yspd)\nTouching ground? <(P_Yspd) > [0]> <(C_Pr_Down) = [1]>\nA_Collision / Crouch\nAttack <(C_Pr_Attack) = [1]> <(C_Pr_Star) = [1]> [7] <(C_Pr_Up) = [1]>\nHit Recovery [8]\nSet coustume\nDirection (A_Direction)\nLevel Transition\n\ndefine Scene 1\npoint in direction (90)\nshow\nswitch costume to (n_intro1 v)\nwait (1) seconds\nrepeat (6)\n    wait (0) seconds\n    next costume\nend\nwait (0.5) seconds\nrepeat (4)\n    wait (0) seconds\n    next costume\nend\nwait (1) seconds\nrepeat (24)\n    wait (0) seconds\n    next costume\nend\nset [_game state v] to [0]\nset [a_direction v] to [90]\n\nwhen I receive [cutscene v]\nif <(_CUTSCENE) = [1]> then\n    Scene 1\nend\n\n@Monsters\n\ndefine Clone (clones)\nset [m_clone id v] to [0]\nrepeat (clones)\n    change [m_clone id v] by (1)\n    create clone of (_myself_ v)\nend\nset [m_clone id v] to [0]\n\nwhen I receive [position v]\nif <not <(M_Clone ID) = [0]>> then\n    set [a_costume # v] to (costume [number v])\n    switch costume to (move v)\n    go to x: ((M_MyX) - (_Camera X)) y: ((M_MyY) - (_Camera Y))\n    if <<(x position) = ((M_MyX) - (_Camera X))> and <(y position) = ((M_MyY) - (_Camera Y))>> then\n        set [hud_show v] to [1]\n    end\n    switch costume to (A_Costume #)\nend\n\nwhen I receive [post-tick v]\nif <not <(M_Clone ID) = [0]>> then\n    if <(M_Respawn Ticks) = [0]> then\n        if <(M_Death) = [0]> then\n            hide\n            set [m_respawn ticks v] to [120]\n            set [e_monster x v] to (M_MyX)\n            set [e_monster y v] to (M_MyY)\n        else\n            if <(M_Monster ID) = [1]> then\n                B_Blitzer action [-130] [470]\n            end\n            if <(M_Monster ID) = [2]> then\n                G_Ghost action\n            end\n        end\n        if <(M_Health) = [0]> then\n            replace item (((M_Clone ID) * (2)) - (1)) of [monster positions v] with [N/A]\n            replace item ((M_Clone ID) * (2)) of [monster positions v] with [N/A]\n        else\n            replace item (((M_Clone ID) * (2)) - (1)) of [monster positions v] with (M_MyX)\n            replace item ((M_Clone ID) * (2)) of [monster positions v] with (M_MyY)\n        end\n    else\n        change [m_respawn ticks v] by (-1)\n        if <(M_Respawn Ticks) = [0]> then\n            Spawn\n        end\n    end\nend\n\nwhen I start as a clone\nadd [0] to [monster positions v]\nadd [0] to [monster positions v]\nSpawn\n\ndefine M_Detect hit\nif <<touching (attacks v)?> and <(M_Hit) = [0]>> then\n    change [m_health v] by (-1)\n    set [m_hit v] to [8]\n    set [a_brightness v] to [10]\n    set [m_roar v] to [0]\n    set [m_attacking v] to [1]\n    broadcast (Monster Hit v)\n    set [e_monster x v] to (M_MyX)\n    set [e_monster y v] to (M_MyY)\n    set [m_xspd v] to (round ((0) - ((M_Xspd) / (2))))\n    Effect [7]\n    start sound [Hit v]\nend\nchange [m_hit v] by (-1)\nif <(M_Hit) < [0]> then\n    set [m_hit v] to [0]\nend\n\ndefine G_Float (x) (y)\nset [m_myx v] to ((([sin v] of ((Sine) * (2)) ) * (6)) + (x))\nset [m_myy v] to ((([sin v] of ((Sine) * (12)) ) * (8)) + (y))\n\ndefine B_Patrol (x) (dis) (speed)\nset rotation style [left-right v]\nif <(A_Patrol Turn) = [0]> then\n    A_Loop [B_Walk] [6] [2]\n    if <(M_Direction) = [1]> then\n        change [m_myx v] by (speed)\n        if <(M_MyX) > ((x) + (dis))> then\n            set [a_patrol turn v] to [38]\n        end\n    else\n        change [m_myx v] by ((0) - (speed))\n        if <(M_MyX) < ((x) - (dis))> then\n            set [a_patrol turn v] to [38]\n        end\n    end\nelse\n    if <(A_Patrol Turn) > [14]> then\n        switch costume to (join [B_Look] ((19) - ((A_Patrol Turn) / (2))))\n    else\n        switch costume to (join [B_Turn] ((7) - ((A_Patrol Turn) / (2))))\n    end\n    change [a_patrol turn v] by (-1)\n    if <(A_Patrol Turn) = [0]> then\n        switch costume to (b_walk1 v)\n        if <(M_Direction) = [0]> then\n            point in direction (90)\n            set [m_direction v] to [1]\n        else\n            point in direction (-90)\n            set [m_direction v] to [0]\n        end\n    end\nend\n\ndefine A_Loop (name) (last) (ticks)\nset [a_costume name number v] to (letter ((length of (name)) + (1)) of (costume [name v]))\nif <not <(costume [name v]) = (join (name) (A_Costume Name Number))>> then\n    switch costume to (join (name) [1])\nelse\n    if <(A_Ticks) > (ticks)> then\n        set [a_ticks v] to [0]\n        if <(costume [name v]) = (join (name) (last))> then\n            switch costume to (join (name) [1])\n        else\n            next costume\n        end\n    end\nend\n\ndefine A_Animate (name) (last) (ticks)\nset [a_costume name number v] to (letter ((length of (name)) + (1)) of (costume [name v]))\nif <not <(costume [name v]) = (join (name) (A_Costume Name Number))>> then\n    switch costume to (join (name) [1])\n    set [a_animation switch v] to [1]\nelse\n    if <(A_Ticks) > (ticks)> then\n        set [a_ticks v] to [0]\n        if <(A_Animation Switch) = [1]> then\n            next costume\n            if <(costume [name v]) = (join (name) (last))> then\n                set [a_animation switch v] to [0]\n            end\n        else\n            switch costume to ((costume [number v]) - (1))\n            if <(costume [name v]) = (join (name) [1])> then\n                set [a_animation switch v] to [1]\n            end\n        end\n    end\nend\n\ndefine Spawn\nshow\nclear graphic effects\nset size to (100) %\nset [m_hit v] to [8]\nset [m_death v] to [34]\nset [m_roar v] to [0]\nset [m_attacking v] to [0]\nset [a_speed v] to [10]\nset [m_health v] to [3]\nset [m_attack v] to [0]\nif <(Level) = [X]> then\n    Level X Spawn Clones\nend\n\ndefine Effect (effect #)\nset [e_effect type v] to (effect #)\nbroadcast (Effect v)\n\nwhen I receive [load level v]\nif <not <(M_Clone ID) = [0]>> then\n    delete this clone\nend\nif <(M_Clone ID) = [0]> then\n    delete all of [monster positions v]\n    if <(Level) = [X]> then\n        Clone (4)\n    else\n        if <(_LEVEL) = [Z]> then\n            No Monsters\n        else\n            if <(Level) = [1]> then\n                No Monsters\n            end\n        end\n    end\nend\n\ndefine B_Blitzer action (minx) (maxx)\nM_Brightness\nif <(M_Health) = [0]> then\n    if <(M_Death) = [34]> then\n        Effect [8]\n    end\n    switch costume to (join [B_Death] ((17) - ((M_Death) / (2))))\n    change [m_death v] by (-1)\nelse\n    M_Detect hit\n    B_Roar [200] [50] (minx) (maxx)\n    if <(M_Roar) = [0]> then\n        if <(M_Attacking) = [0]> then\n            set [m_xspd v] to [0]\n            B_Patrol [200] [100] [2]\n        else\n            if <(M_Attacking) > [1]> then\n                if <(M_Attack) = [0]> then\n                    if <<([p_myx v] of [player v]) < (minx)> or <([p_myx v] of [player v]) > (maxx)>> then\n                        set [m_roar v] to [30]\n                        set [m_attacking v] to [0]\n                    else\n                        B_Chase [8] [75]\n                    end\n                else\n                    B_Decelarate\n                    switch costume to (join [B_Attack] ((13) - ((M_Attack) / (2))))\n                    if <<(M_Attack) = [13]> or <(M_Attack) = [12]>> then\n                        if <touching (player v)?> then\n                            broadcast (Player Hit v)\n                        end\n                    end\n                    change [m_attack v] by (-1)\n                end\n                change [m_myx v] by (M_Xspd)\n            end\n        end\n    else\n        switch costume to (join [B_Roar] ((15) - ((M_Roar) / (2))))\n    end\n    change [a_ticks v] by (1)\nend\n\ndefine G_Ghost action\nM_Brightness\nM_Detect hit\nif <(M_Health) = [0]> then\n    Effect [8]\n    set [m_death v] to [0]\nend\nA_Animate [GH_Float] [6] [2]\nchange [a_ticks v] by (1)\nG_Float (M_Initial X) (M_Inital Y)\n\ndefine B_Roar (xdis) (ydis) (minx) (maxx)\nset [m_player seen v] to [0]\nif <<([p_myx v] of [player v]) > (minx)> and <([p_myx v] of [player v]) < (maxx)>> then\n    if <(M_Direction) = [1]> then\n        if <([p_myx v] of [player v]) > (M_MyX)> then\n            if <([abs v] of ((M_MyX) - ([p_myx v] of [player v])) ) < (xdis)> then\n                if <([abs v] of ((M_MyY) - ([p_myy v] of [player v])) ) < (ydis)> then\n                    set [m_player seen v] to [1]\n                end\n            end\n        end\n    end\n    if <(M_Direction) = [0]> then\n        if <([p_myx v] of [player v]) < (M_MyX)> then\n            if <([abs v] of ((M_MyX) - ([p_myx v] of [player v])) ) < (xdis)> then\n                if <([abs v] of ((M_MyY) - ([p_myy v] of [player v])) ) < (ydis)> then\n                    set [m_player seen v] to [1]\n                end\n            end\n        end\n    end\nend\nif <(M_Roar) = [0]> then\n    if <<(M_Player Seen) = [1]> and <(M_Attacking) = [0]>> then\n        set [m_roar v] to [30]\n        set [m_attacking v] to [1]\n    end\n    if <(M_Attacking) = [1]> then\n        set [m_attacking v] to [2]\n    end\nelse\n    change [m_roar v] by (-1)\nend\n\ndefine B_Chase (max speed) (min distance)\nif <(A_Turn) = [0]> then\n    if <([abs v] of (M_Xspd) ) = [8]> then\n        A_Loop [B_Sprint] [6] [1]\n    else\n        switch costume to (join [B_Run] ([ceiling v] of (([abs v] of (M_Xspd) ) / (2)) ))\n    end\n    if <([p_myx v] of [player v]) > (M_MyX)> then\n        if <(M_Direction) = [0]> then\n            set [a_turn v] to [7]\n            switch costume to (b_turn1 v)\n        else\n            change [m_xspd v] by (1)\n            if <(M_Xspd) > (max speed)> then\n                set [m_xspd v] to (max speed)\n            end\n            if <([abs v] of ((M_MyX) - ([p_myx v] of [player v])) ) < (min distance)> then\n                set [m_attacking v] to [3]\n                set [m_attack v] to [26]\n            end\n        end\n    end\n    if <([p_myx v] of [player v]) < (M_MyX)> then\n        if <(M_Direction) = [1]> then\n            set [a_turn v] to [7]\n            switch costume to (b_turn1 v)\n        else\n            change [m_xspd v] by (-1)\n            if <(M_Xspd) < ((0) - (max speed))> then\n                set [m_xspd v] to ((0) - (max speed))\n            end\n            if <([abs v] of ((M_MyX) - ([p_myx v] of [player v])) ) < (min distance)> then\n                set [m_attacking v] to [3]\n                set [m_attack v] to [26]\n            end\n        end\n    end\nelse\n    switch costume to (join [B_Turn] ((7) - (A_Turn)))\n    change [a_turn v] by (-1)\n    if <(A_Turn) = [0]> then\n        switch costume to (b_run1 v)\n        if <(M_Direction) = [1]> then\n            point in direction (-90)\n            set [m_direction v] to [0]\n        else\n            point in direction (90)\n            set [m_direction v] to [1]\n        end\n    end\nend\n\nforever\n    go to x: (0) y: (0)\n    show\n    switch costume to (b_death1 v)\n    repeat (16)\n        wait (0) seconds\n        next costume\n    end\nend\n\nwhen flag clicked\nswitch costume to (thumbnail v)\nhide\n\ndefine B_Decelarate\nif <not <(M_Xspd) = [0]>> then\n    if <(M_Xspd) < [0]> then\n        change [m_xspd v] by (1)\n    else\n        change [m_xspd v] by (-1)\n    end\nend\n\ndefine M_Brightness\nif <not <(A_Brightness) = [0]>> then\n    change [a_brightness v] by (-1)\n    set [brightness v] effect to ((A_Brightness) * (10))\nend\n\ndefine Level X Spawn Clones\nif <(M_Clone ID) = [1]> then\n    B_Spawn Blitzer [150] [582]\nelse\n    if <(M_Clone ID) = [2]> then\n        B_Spawn Blitzer [250] [582]\n    else\n        if <(M_Clone ID) = [3]> then\n            G_Spawn ghost [0] [700]\n        else\n            if <(M_Clone ID) = [4]> then\n                G_Spawn ghost [800] [800]\n            end\n        end\n    end\nend\n\ndefine B_Spawn Blitzer (initial x) (y)\nset [m_monster id v] to [1]\nset [m_direction v] to (pick random (0) to (1))\nif <(M_Direction) = [1]> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\nset [m_initial x v] to (initial x)\nset [m_myy v] to (y)\nswitch costume to (b_stance v)\n\ndefine G_Spawn ghost (x) (y)\nset [m_monster id v] to [2]\nset [m_initial x v] to (x)\nset [m_inital y v] to (y)\nswitch costume to (gh_float2 v)\n\ndefine No Monsters\nrepeat (8)\n    add [N/A] to [monster positions v]\nend\n\n@Looks\n\nwhen I receive [position v]\nswitch costume to (move v)\ngo to x: (() - (_CAMERA X)) y: (() - (_CAMERA Y))\nswitch costume to (join [Level_] (join (_LEVEL) (join [_] (Clone ID))))\n\nif <not <(Clone ID) = [0]>> then\n    switch costume to (move v)\n    go to x: (() - (_CAMERA X)) y: (() - (_CAMERA Y))\n    switch costume to (join [Level_] (join (_LEVEL) (join [_] (Clone ID))))\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (sizer v)\nset size to (2000) %\nhide\nset [clone id v] to [0]\n\nwhen I receive [load level v]\nif <(Clone ID) = [0]> then\n    if <(_LEVEL) = [X]> then\n        Clone [1]\n    else\n        if <(_LEVEL) = [Z]> then\n            Clone [1]\n        else\n            if <(_LEVEL) = [1]> then\n                Clone [3]\n            else\n                if <(_LEVEL) = [2]> then\n            end\n        end\n    end\nelse\n    delete this clone\nend\nswitch costume to (join [Level_] (join (_LEVEL) (join [_] (Clone ID))))\n\ndefine Clone (clones)\nset [clone id v] to [0]\nrepeat (clones)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone id v] to [0]\n\nwhen I start as a clone\nswitch costume to (sizer v)\nset size to (2000) %\nshow\n\nwhen I receive [menu v]\nhide\ndelete this clone\n\nwhen I receive [menu - level v]\nhide\n\n@Parallax\n\ndefine Clone (clones)\nset [clone id v] to [0]\nrepeat (clones)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone id v] to [0]\n\nwhen I receive [position v]\nif <not <(Clone ID) = [0]>> then\n    set [costume# v] to (costume [number v])\n    switch costume to (move v)\n    if <(Clone ID) = [1]> then\n        go to x: ((() - (_CAMERA X)) * (2)) y: ((() - (_CAMERA Y)) * (2))\n    else\n        if <(Clone ID) = [2]> then\n            go to x: ((() - (_CAMERA X)) / (1.5)) y: ((() - (_CAMERA Y)) / (1.5))\n        else\n            go to x: ((() - (_CAMERA X)) / (((Clone ID) - (1)) * (2))) y: ((() - (_CAMERA Y)) / (((Clone ID) - (1)) * (2)))\n        end\n    end\n    switch costume to (Costume#)\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\nset [_camera x v] to [0]\nClone (5)\ndelete this clone\n\nwhen I start as a clone\nshow\nswitch costume to (sizer v)\nset size to ((2000) - ((Clone ID) * (100))) %\nSet Costume\ngo to [back v] layer\ngo [forward v] ((4) - (Clone ID)) layers\nif <(Clone ID) = [1]> then\n    go to [front v] layer\n    go [backward v] (15) layers\nend\n\ndefine Set Costume\nif <(Clone ID) = [1]> then\n    switch costume to (join [F_Fore_] (_LEVEL))\nelse\n    if <(Clone ID) = [2]> then\n        switch costume to (join [B_Fore_] (_LEVEL))\n    else\n        if <(Clone ID) = [3]> then\n            switch costume to (join [B_Front_] (_LEVEL))\n        else\n            if <(Clone ID) = [4]> then\n                switch costume to (join [B_Mid_] (_LEVEL))\n            else\n                if <(Clone ID) = [5]> then\n                    switch costume to (join [B_Back_] (_LEVEL))\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [load level v]\nSet Costume\n\nwhen I receive [menu - level v]\nshow\n\nwhen I receive [menu v]\nhide\n\n@Collision\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\nswitch costume to (sizer v)\nset size to (2000) %\nswitch costume to (join [Collision_] (_LEVEL))\n\nwhen I receive [load level v]\nswitch costume to (join [Collision_] (_LEVEL))\ngo to x: ((0) - (_CAMERA X)) y: ((0) - (_CAMERA Y))\n\nif <(_LEVEL) = [2]> then\n    set [ghost v] effect to (0)\nelse\n    set [ghost v] effect to (100)\nend\n\nwhen I receive [position v]\ngo to x: ((0) - (_CAMERA X)) y: ((0) - (_CAMERA Y))\n\nwhen I receive [tick v]\nif <(_LEVEL) = [1]> then\n    switch costume to (join [Collision_] (join (_LEVEL) (join [,] (_Breakable Walls))))\nelse\n    switch costume to (join [Collision_] (join (_LEVEL) (join [,] (_Breakable Walls))))\nend\n\n@Platforms\n\nwhen I receive [position v]\nswitch costume to (move v)\ngo to x: (() - (_CAMERA X)) y: (() - (_CAMERA Y))\nswitch costume to (join [Platforms_] (_LEVEL))\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (sizer v)\nset size to (2000) %\nswitch costume to (collision v)\nset [ghost v] effect to (100)\n\nwhen I receive [load level v]\nswitch costume to (join [Platforms_] (_LEVEL))\ngo to x: (() - (_CAMERA X)) y: (() - (_CAMERA Y))\nset [ghost v] effect to (100)\n\n@Effects\n\ndefine Clone (clones)\nset [clone id v] to [0]\nrepeat (clones)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone id v] to [0]\n\nwhen I receive [effect v]\nif <(Clone ID) = [0]> then\n    set [effect v] to (E_Effect type)\n    if <(E_Effect type) < [4]> then\n        Clone (6)\n    else\n        if <(E_Effect type) < [6]> then\n            Clone (2)\n        else\n            if <(E_Effect type) = [6]> then\n                Clone (1)\n            else\n                if <(E_Effect type) = [7]> then\n                    Clone (pick random (3) to (5))\n                else\n                    if <(E_Effect type) = [8]> then\n                        Clone (pick random (3) to (8))\n                    else\n                        if <(E_Effect type) = [9]> then\n                            Clone (1)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\ngo to [front v] layer\ngo [backward v] (20) layers\nSetup\nif <(Effect) < [4]> then\n    E_1 2 3 setup\nelse\n    if <(Effect) < [6]> then\n        E_4 5 Setup\n    else\n        if <(Effect) = [6]> then\n            E_6 setup\n        else\n            if <(Effect) = [7]> then\n                E_7 Setup\n            else\n                if <(Effect) = [8]> then\n                    E_8 Setup\n                else\n                    if <(Effect) = [9]> then\n                        E_9 Setup\n                    end\n                end\n            end\n        end\n    end\nend\ngo to x: ((Xpos) - (_Camera X)) y: ((Ypos) - (_Camera Y))\n\nwhen I receive [position v]\nif <not <(Clone ID) = [0]>> then\n    go to x: ((Xpos) - (_Camera X)) y: ((Ypos) - (_Camera Y))\n    set size to (Size) %\nend\n\nwhen I receive [tick v]\nif <not <(Clone ID) = [0]>> then\n    if <(Effect) < [4]> then\n        E_1 2 3 Action\n    else\n        if <(Effect) < [6]> then\n            E_4 5 Action\n        else\n            if <(Effect) = [6]> then\n                E_6 Action\n            else\n                if <(Effect) = [7]> then\n                    E_7 Action\n                else\n                    if <(Effect) = [8]> then\n                        E_8 Action\n                    else\n                        if <(Effect) = [9]> then\n                            E_9 Action\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Setup\npoint in direction (90)\nshow\nclear graphic effects\nset [xpos v] to ([p_myx v] of [player v])\nset [ypos v] to ([p_myy v] of [player v])\n\ndefine E_1 2 3 setup\nset [size v] to [200]\nset [time v] to [10]\nchange [ypos v] by (-40)\nif <(Clone ID) < [4]> then\n    if <(Effect) = [1]> then\n        point in direction (90)\n        set [xspd v] to [8]\n        switch costume to (line v)\n    end\n    if <(Effect) = [2]> then\n        point in direction (0)\n        set [yspd v] to [8]\n        switch costume to (line v)\n        if <([a_direction v] of [player v]) = [90]> then\n            change [xpos v] by (-10)\n        else\n            change [xpos v] by (10)\n        end\n    end\n    if <(Effect) = [3]> then\n        point in direction (0)\n        turn right (([p_xspd v] of [player v]) * (2)) degrees\n        set [xspd v] to [6]\n        switch costume to (line v)\n        if <(Clone ID) = [1]> then\n            Move: [6] In direction: ((direction) - (90))\n        else\n            if <(Clone ID) = [3]> then\n                Move: [6] In direction: ((direction) + (90))\n            end\n        end\n    end\n    if <(Clone ID) = [2]> then\n        switch costume to (dust v)\n        set [size v] to [300]\n    end\nelse\n    if <(Clone ID) < [7]> then\n        point in direction (0)\n        turn right (([p_xspd v] of [player v]) * (2)) degrees\n        switch costume to (line v)\n        if <(Clone ID) = [4]> then\n            set [xspd v] to [8]\n            Move: [8] In direction: ((direction) - (90))\n        else\n            if <(Clone ID) = [5]> then\n                set [xspd v] to [14]\n            else\n                if <(Clone ID) = [6]> then\n                    set [xspd v] to [8]\n                    Move: [8] In direction: ((direction) + (90))\n                end\n            end\n        end\n    end\nend\n\ndefine E_1 2 3 Action\nif <(Clone ID) < [7]> then\n    if <(Time) < [1]> then\n        delete this clone\n    end\n    change [time v] by (-1)\n    change [size v] by (-10)\n    change [ghost v] effect by (10)\n    if <(Clone ID) < [4]> then\n        change [size v] by (-10)\n        if <(Effect) = [1]> then\n            if <(Clone ID) = [1]> then\n                change [xpos v] by (Xspd)\n            else\n                if <(Clone ID) = [3]> then\n                    change [xpos v] by (() - (Xspd))\n                end\n            end\n            set [xspd v] to ((Xspd) * (0.8))\n        end\n        if <(Effect) = [2]> then\n            if <(Clone ID) = [1]> then\n                change [ypos v] by (Yspd)\n            else\n                if <(Clone ID) = [3]> then\n                    change [ypos v] by (() - (Yspd))\n                end\n            end\n            set [yspd v] to ((Yspd) * (0.8))\n        end\n        if <(Effect) = [3]> then\n            if <<(Clone ID) = [1]> or <(Clone ID) = [3]>> then\n                Move: ((0) - (Xspd)) In direction: (direction)\n                set [xspd v] to ((Xspd) * (0.8))\n            end\n        end\n    else\n        if <(Clone ID) < [7]> then\n            Move: (Xspd) In direction: (direction)\n            set [xspd v] to ((Xspd) * (0.8))\n        end\n    end\nend\n\ndefine Move: (x) In direction: (direction)\nchange [xpos v] by ((x) * ([cos v] of (((0) - (direction)) + (90)) ))\nchange [ypos v] by ((x) * ([sin v] of (((0) - (direction)) + (90)) ))\n\ndefine E_4 5 Setup\nset [size v] to [200]\nset [time v] to [10]\nchange [ypos v] by (-20)\nif <(Effect) = [4]> then\n    point in direction (90)\n    set [xspd v] to [10]\n    switch costume to (line v)\nend\nif <(Effect) = [5]> then\n    point in direction (0)\n    set [yspd v] to [10]\n    switch costume to (line v)\n    if <([p_wall v] of [player v]) = [1]> then\n        change [xpos v] by (-10)\n    else\n        change [xpos v] by (10)\n    end\nend\n\ndefine E_4 5 Action\nif <(Time) < [1]> then\n    delete this clone\nend\nchange [time v] by (-1)\nchange [size v] by (-20)\nchange [ghost v] effect by (10)\nif <(Effect) = [4]> then\n    if <(Clone ID) = [1]> then\n        change [xpos v] by (Xspd)\n    else\n        if <(Clone ID) = [2]> then\n            change [xpos v] by (() - (Xspd))\n        end\n    end\n    set [xspd v] to ((Xspd) * (0.8))\nend\nif <(Effect) = [5]> then\n    if <(Clone ID) = [1]> then\n        change [ypos v] by (Yspd)\n    else\n        if <(Clone ID) = [2]> then\n            change [ypos v] by (() - (Yspd))\n        end\n    end\n    set [yspd v] to ((Yspd) * (0.8))\nend\n\nwhen flag clicked\nset [clone id v] to [0]\ndelete this clone\n\ndefine E_6 setup\nset [size v] to [100]\nset [ghost v] effect to (50)\nset [yspd v] to [0]\nset [time v] to [10]\nchange [ypos v] by (-20)\npoint in direction (0)\nswitch costume to (line v)\nif <([p_wall v] of [player v]) = [1]> then\n    change [xpos v] by (-10)\nelse\n    change [xpos v] by (10)\nend\n\ndefine E_6 Action\nif <(Time) < [1]> then\n    delete this clone\nend\nchange [time v] by (-1)\nchange [size v] by (-10)\nchange [ghost v] effect by (5)\nchange [ypos v] by (Yspd)\n\ndefine E_7 Setup\nset [size v] to [200]\nset [ghost v] effect to (0)\nswitch costume to (monster bit v)\nset [time v] to [10]\nset [xpos v] to (E_Monster X)\nset [ypos v] to (E_Monster Y)\nif <([p_attack v] of [player v]) = [1]> then\n    set [yspd v] to (pick random (6) to (0))\n    if <([a_direction v] of [player v]) = [90]> then\n        set [xspd v] to (pick random (2) to (12))\n    else\n        set [xspd v] to (pick random (-2) to (-12))\n    end\nelse\n    if <([p_attack v] of [player v]) = [2]> then\n        set [yspd v] to (pick random (-2) to (-12))\n        set [xspd v] to (pick random (-2) to (2))\n    else\n        set [yspd v] to (pick random (16) to (2))\n        set [xspd v] to (pick random (-2) to (2))\n    end\nend\n\ndefine E_7 Action\nif <(Time) < [1]> then\n    delete this clone\nend\nchange [time v] by (-1)\nchange [size v] by (-20)\nchange [ghost v] effect by (10)\nchange [xpos v] by (Xspd)\nchange [ypos v] by (Yspd)\nchange [yspd v] by (-1)\n\ndefine E_8 Setup\nif <(Clone ID) = [1]> then\n    set [size v] to [800]\nelse\n    set [size v] to [200]\nend\nset [ghost v] effect to (0)\nswitch costume to (monster bit v)\nset [time v] to [10]\nset [xpos v] to (E_Monster X)\nset [ypos v] to (E_Monster Y)\nset [yspd v] to (pick random (16) to (2))\nset [xspd v] to (pick random (-12) to (12))\n\ndefine E_8 Action\nif <(Time) < [1]> then\n    delete this clone\nend\nchange [time v] by (-1)\nchange [size v] by (-20)\nchange [ghost v] effect by (10)\nif <(Clone ID) = [1]> then\n    change [size v] by (-20)\nelse\n    change [xpos v] by (Xspd)\n    change [ypos v] by (Yspd)\n    change [yspd v] by (-1)\nend\n\ndefine E_9 Setup\nset [size v] to [100]\nset [ghost v] effect to (0)\nset [time v] to [10]\nchange [ypos v] by (-20)\npoint in direction (90)\nswitch costume to (line v)\nif <([a_direction v] of [player v]) = [90]> then\n    set [xspd v] to ([p_xspd v] of [player v])\n    change [xpos v] by (10)\nelse\n    set [xspd v] to ([p_xspd v] of [player v])\n    change [xpos v] by (-10)\nend\n\ndefine E_9 Action\nif <(Time) < [1]> then\n    delete this clone\nend\nchange [time v] by (-1)\nchange [size v] by (-20)\nchange [ghost v] effect by (10)\nturn left ((Xspd) / (2)) degrees\nMove: (Xspd) In direction: (direction)\nset [xspd v] to ((Xspd) / (1.2))\n\n@Shadows\n\ndefine Clone (clones)\nset [clone id v] to [0]\nrepeat (clones)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone id v] to [0]\n\nwhen I receive [post-tick v]\nif <not <(Clone ID) = [0]>> then\n    if <(Clone ID) = [1]> then\n        Y Shadow ([p_myx v] of [player v]) ([p_myy v] of [player v])\n    else\n        if <(Clone ID) = [2]> then\n            X Shadow ([p_myx v] of [player v]) ([p_myy v] of [player v])\n        else\n            if <(Clone ID) = [3]> then\n                Y Shadow (item (1) of [monster positions v]) (item (2) of [monster positions v])\n                if <(item (1) of [monster positions v]) = [N/A]> then\n                    hide\n                else\n                    show\n                end\n            else\n                if <(Clone ID) = [4]> then\n                    Y Shadow (item (3) of [monster positions v]) (item (4) of [monster positions v])\n                    if <(item (3) of [monster positions v]) = [N/A]> then\n                        hide\n                    else\n                        show\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [position v]\nswitch costume to (move v)\ngo to x: ((MyX) - (_CAMERA X)) y: ((MyY) - (_CAMERA Y))\nswitch costume to (drop shadow v)\nif <(Clone ID) = [2]> then\n    switch costume to (side shadow v)\nend\nset size to (Size) %\n\ndefine Y Shadow (x) (y)\nswitch costume to (hitbox v)\nshow\nset size to (100) %\nset [myx v] to (x)\nset [myy v] to (y)\ngo to x: ((MyX) - (_CAMERA X)) y: ((MyY) - (_CAMERA Y))\nset [failsafe v] to [0]\nset [size v] to [550]\nif <(Clone ID) = [1]> then\n    repeat until <<<touching (collision v)?> or <<touching (platforms v)?> and <([p_platform ticks v] of [player v]) = [0]>>> or <(Failsafe) > [30]>>\n        change y by (-4)\n        change [myy v] by (-4)\n        change [size v] by (-12)\n        change [failsafe v] by (1)\n    end\nelse\n    repeat until <<<touching (collision v)?> or <touching (platforms v)?>> or <(Failsafe) > [30]>>\n        change y by (-4)\n        change [myy v] by (-4)\n        change [size v] by (-12)\n        change [failsafe v] by (1)\n    end\nend\nif <(Failsafe) > [30]> then\n    hide\nend\nswitch costume to (drop shadow v)\n\nwhen I start as a clone\nset [ghost v] effect to (75)\ngo to [front v] layer\ngo [backward v] (25) layers\n\nwhen I receive [load level v]\nif <(Clone ID) = [0]> then\n    if <(_LEVEL) = [X]> then\n        Clone (4)\n    else\n        Clone (2)\n    end\nelse\n    delete this clone\nend\n\ndefine X Shadow (x) (y)\nswitch costume to (hitbox v)\nshow\nset size to (100) %\nset [myx v] to (x)\nset [myy v] to (y)\ngo to x: ((MyX) - (_CAMERA X)) y: ((MyY) - (_CAMERA Y))\nset [failsafe v] to [0]\nset [size v] to [550]\nrepeat until <<touching (collision v)?> or <(Failsafe) > [20]>>\n    change x by (4)\n    change [myx v] by (4)\n    change [size v] by (-24)\n    change [failsafe v] by (1)\nend\nif <(Failsafe) > [20]> then\n    set [myx v] to (x)\n    set [myy v] to (y)\n    go to x: ((MyX) - (_CAMERA X)) y: ((MyY) - (_CAMERA Y))\n    set [failsafe v] to [0]\n    set [size v] to [550]\n    repeat until <<touching (collision v)?> or <(Failsafe) > [20]>>\n        change x by (-4)\n        change [myx v] by (-4)\n        change [size v] by (-24)\n        change [failsafe v] by (1)\n    end\n    if <(Failsafe) > [20]> then\n        hide\n    end\nend\nswitch costume to (side shadow v)\n\nwhen I receive [cutscene v]\nif <(_CUTSCENE) = [1]> then\n    if <(Clone ID) = [1]> then\n        Y Shadow ([p_myx v] of [player v]) ([p_myy v] of [player v])\n        set size to (Size) %\n    else\n        if <(Clone ID) = [2]> then\n            X Shadow ([p_myx v] of [player v]) ([p_myy v] of [player v])\n            set size to (Size) %\n        else\n        end\n    end\nend\n\nwhen flag clicked\nset [clone id v] to [0]\ndelete this clone\n\n@Non- Wall\n\nwhen I receive [position v]\nswitch costume to (move v)\ngo to x: (() - (_Camera X)) y: (() - (_Camera Y))\nswitch costume to (join [NW_] (Level))\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (sizer v)\nset size to (2000) %\nswitch costume to (nw_x v)\nset [ghost v] effect to (100)\n\nwhen I receive [load level v]\nswitch costume to (join [NW_] (Level))\n\nif <(Level) = [1]> then\n    set [ghost v] effect to (0)\nelse\n    set [ghost v] effect to (100)\nend\n\n@Attacks\n\ndefine Clone (clones)\nset [clone id v] to [0]\nrepeat (clones)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone id v] to [0]\n\nwhen I receive [attack v]\nif <(Clone ID) = [0]> then\n    if <(E_Attack type) = [1]> then\n        Clone (1)\n    else\n        Clone (2)\n    end\nend\n\nwhen I receive [tick v]\nif <not <(Clone ID) = [0]>> then\n    if <(E_Attack type) = [1]> then\n        Sword tick\n    else\n        if <(E_Attack type) = [2]> then\n            Star tick\n        end\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\nswitch costume to (nothing v)\ngo to [front v] layer\ngo [backward v] (20) layers\nshow\nset [xpos v] to ([p_myx v] of [player v])\nset [ypos v] to ([p_myy v] of [player v])\ngo to x: ((Xpos) - (_CAMERA X)) y: ((Ypos) - (_CAMERA Y))\nset [clone type v] to (E_Attack type)\nif <(E_Attack type) = [1]> then\n    Sword attack\nelse\n    if <(E_Attack type) = [2]> then\n        go to x: ((Xpos) - (_CAMERA X)) y: ((Ypos) - (_CAMERA Y))\n        Star attack\n    end\nend\nset [initial speed v] to (Speed)\n\nwhen I receive [position v]\nif <not <(Clone ID) = [0]>> then\n    set [costume # v] to (costume [number v])\n    switch costume to (move v)\n    go to x: ((Xpos) - (_Camera X)) y: ((Ypos) - (_Camera Y))\n    switch costume to (Costume #)\nend\n\ndefine Sword attack\nset [speed v] to [18]\nswitch costume to (nothing v)\nif <([p_attack direction v] of [player v]) = [1]> then\n    change [speed v] by ([abs v] of (([p_xspd v] of [player v]) * (1.5)) )\n    if <([p_wall v] of [player v]) = [0]> then\n        if <([a_direction v] of [player v]) = [90]> then\n            point in direction (90)\n            change [xpos v] by (60)\n            set [clone type v] to [1]\n        else\n            point in direction (-90)\n            change [xpos v] by (-60)\n            set [clone type v] to [2]\n        end\n    else\n        if <([a_direction v] of [player v]) = [90]> then\n            point in direction (-90)\n            change [xpos v] by (-60)\n            set [clone type v] to [2]\n        else\n            point in direction (90)\n            change [xpos v] by (60)\n            set [clone type v] to [1]\n        end\n    end\nelse\n    change [speed v] by ([abs v] of (([p_yspd v] of [player v]) * (1.5)) )\n    if <([p_attack direction v] of [player v]) = [2]> then\n        point in direction (180)\n        change [ypos v] by (-60)\n        set [clone type v] to [3]\n    else\n        if <([p_attack direction v] of [player v]) = [3]> then\n            point in direction (0)\n            change [ypos v] by (60)\n            set [clone type v] to [4]\n        end\n    end\nend\n\ndefine Star attack\nset [speed v] to [48]\nif <(Clone ID) = [1]> then\n    set [ghost v] effect to ((100) - ((Speed) * (10)))\nelse\n    set [ghost v] effect to ((50) + ((50) - (Speed)))\nend\nif <(Clone ID) = [1]> then\n    switch costume to (ninja star v)\nelse\n    switch costume to (ninja star dash v)\nend\nif <([p_attack direction v] of [player v]) = [1]> then\n    change [speed v] by ([abs v] of (([p_xspd v] of [player v]) * (3)) )\n    if <([p_wall v] of [player v]) = [0]> then\n        if <([a_direction v] of [player v]) = [90]> then\n            point in direction (90)\n            change [xpos v] by (60)\n            set [clone type v] to [1]\n        else\n            point in direction (-90)\n            change [xpos v] by (-60)\n            set [clone type v] to [2]\n        end\n    else\n        if <([a_direction v] of [player v]) = [90]> then\n            point in direction (-90)\n            change [xpos v] by (-60)\n            set [clone type v] to [2]\n        else\n            point in direction (90)\n            change [xpos v] by (60)\n            set [clone type v] to [1]\n        end\n    end\nelse\n    change [speed v] by ([abs v] of (([p_yspd v] of [player v]) * (3)) )\n    if <([p_attack direction v] of [player v]) = [2]> then\n        point in direction (180)\n        change [ypos v] by (-60)\n        set [clone type v] to [3]\n    else\n        if <([p_attack direction v] of [player v]) = [3]> then\n            point in direction (0)\n            change [ypos v] by (60)\n            set [clone type v] to [4]\n        end\n    end\nend\n\ndefine Sword tick\nnext costume\nchange [speed v] by ((0) - ((Initial speed) / (6)))\nif <(Speed) < [0]> then\n    delete this clone\nend\nif <(Clone type) = [1]> then\n    change [xpos v] by (Speed)\nelse\n    if <(Clone type) = [2]> then\n        change [xpos v] by ((0) - (Speed))\n    else\n        if <(Clone type) = [3]> then\n            change [ypos v] by ((0) - (Speed))\n        else\n            if <(Clone type) = [4]> then\n                change [ypos v] by (Speed)\n            end\n        end\n    end\nend\n\ndefine Star tick\nchange [speed v] by ((0) - ((Initial speed) / (14)))\nif <(Speed) < [0]> then\n    delete this clone\nend\nchange size by (-2)\nif <(Clone ID) = [1]> then\n    turn right ((Speed) * (2)) degrees\n    set [ghost v] effect to ((100) - ((Speed) * (10)))\nelse\n    set [ghost v] effect to ((50) + ((50) - (Speed)))\nend\nif <(Clone type) = [1]> then\n    change [xpos v] by (Speed)\nelse\n    if <(Clone type) = [2]> then\n        change [xpos v] by ((0) - (Speed))\n    else\n        if <(Clone type) = [3]> then\n            change [ypos v] by ((0) - (Speed))\n        else\n            if <(Clone type) = [4]> then\n                change [ypos v] by (Speed)\n            end\n        end\n    end\nend\n\n@Health Effects\n\ndefine Clone (clones)\nset [clone id v] to [0]\nrepeat (clones)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone id v] to [0]\n\nwhen flag clicked\nClone (4)\n\nwhen I start as a clone\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\ngo [backward v] ((Clone ID) + (10)) layers\nset [ghost v] to [100]\nset [ghost v] effect to (100)\nif <(Clone ID) = [1]> then\n    switch costume to (spikes v)\nelse\n    if <(Clone ID) = [2]> then\n        switch costume to (veins v)\n    else\n        if <(Clone ID) = [3]> then\n            switch costume to (red fader v)\n        else\n            if <(Clone ID) = [4]> then\n                switch costume to (hit fader v)\n            end\n        end\n    end\nend\n\nwhen I receive [tick v]\nif <not <(Clone ID) = [0]>> then\n    if <(Clone ID) < [4]> then\n        Clones 1,2,3\n    else\n        Clone 4\n    end\nend\n\ndefine Sizer (size)\nset [costume # v] to (costume [number v])\nswitch costume to (sizer v)\nset size to (size) %\nswitch costume to (Costume #)\n\ndefine Smooth Size (size)\nSizer ((size) - (((size) - (size)) / (4)))\n\ndefine Smooth Ghost (ghost)\nset [ghost v] to ((Ghost) - (((Ghost) - (ghost)) / (4)))\nset [ghost v] effect to (Ghost)\n\ndefine Clones 1,2,3\nif <([p_health v] of [player v]) = [3]> then\n    if <(Clone ID) = [3]> then\n        Smooth Size ((([sin v] of ((Sine) * (10)) ) * (10)) + (800))\n        Smooth Ghost [75]\n    else\n        Smooth Size [2000]\n        Smooth Ghost [100]\n    end\nelse\n    if <([p_health v] of [player v]) = [2]> then\n        if <(Clone ID) = [3]> then\n            Smooth Size ((([sin v] of ((Sine) * (10)) ) * (10)) + (900))\n            Smooth Ghost [50]\n        else\n            if <(Clone ID) = [2]> then\n                Smooth Ghost [100]\n                Smooth Size [1300]\n            else\n                if <(Clone ID) = [1]> then\n                    Smooth Ghost [90]\n                    Smooth Size ((([sin v] of (((Sine) + (40)) * (10)) ) * (40)) + (1200))\n                end\n            end\n        end\n    else\n        if <([p_health v] of [player v]) = [1]> then\n            if <(Clone ID) = [3]> then\n                Smooth Size ((([sin v] of ((Sine) * (20)) ) * (10)) + (700))\n                Smooth Ghost [25]\n            else\n                if <(Clone ID) = [2]> then\n                    Smooth Ghost [80]\n                    Smooth Size ((([sin v] of (((Sine) + (20)) * (20)) ) * (10)) + (1100))\n                else\n                    if <(Clone ID) = [1]> then\n                        Smooth Ghost [80]\n                        Smooth Size ((([sin v] of (((Sine) + (40)) * (20)) ) * (60)) + (1100))\n                    end\n                end\n            end\n        else\n            Smooth Ghost [100]\n            Smooth Size [2000]\n        end\n    end\nend\n\ndefine Clone 4\nSizer [600]\nSmooth Ghost ((100) - (([p_hit ticks v] of [player v]) * (8)))\n\n@Sketchpad\n\n@HUD\n\ndefine Clone (clones)\nset [clone id v] to [0]\nrepeat (clones)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone id v] to [0]\n\nwhen flag clicked\nClone (7)\n\nwhen I start as a clone\nshow\nset size to (100) %\nclear graphic effects\npoint in direction (90)\nif <(Clone ID) = [1]> then\n    switch costume to (hud base v)\n    go to x: (-150) y: (135)\n    go to [front v] layer\n    go [backward v] (6) layers\nelse\n    if <(Clone ID) = [2]> then\n        switch costume to (hb_5 v)\n        go to x: (-150) y: (150)\n        go to [front v] layer\n        go [backward v] (5) layers\n    else\n        if <(Clone ID) > [2]> then\n            switch costume to (ninja star v)\n            go to x: (-150) y: (130)\n            go to [front v] layer\n            go [backward v] ((Clone ID) - (2)) layers\n        end\n    end\nend\n\nwhen I receive [tick v]\nif <(Clone ID) = [0]> then\n    if <(_HUD_SHOW) = [1]> then\n        HUD Ghost [0]\n        change [hud_ticks v] by (1)\n        if <(HUD_Ticks) > [150]> then\n            set [_hud_show v] to [0]\n        end\n    else\n        HUD Ghost [80]\n        set [hud_ticks v] to [0]\n    end\n    set [_hud_star animation v] to ((_HUD_STAR ANIMATION) * (0.9))\n    set [_hud_star animation v] to ((_HUD_STAR ANIMATION) + (1))\nelse\n    if <(Clone ID) = [1]> then\n        Ghost (_HUD_GHOST)\n        go to x: (-150) y: (135)\n    else\n        if <(Clone ID) = [2]> then\n            Ghost (_HUD_GHOST)\n            switch costume to (join [HB_] ([p_health v] of [player v]))\n            if <([p_health v] of [player v]) < [3]> then\n                go to x: ((-140) + (((pick random (-1.2) to (1.2)) * (((3) - ([p_health v] of [player v])) / ([p_health v] of [player v]))) + ((pick random (-1.2) to (1.2)) * (([p_hit ticks v] of [player v]) / (3))))) y: ((150) + ((pick random (-1.2) to (1.2)) * (((3) - ([p_health v] of [player v])) / (2))))\n            else\n                go to x: ((-140) + ((pick random (-1.2) to (1.2)) * (([p_hit ticks v] of [player v]) / (3)))) y: (150)\n            end\n        else\n            if <(Clone ID) > [2]> then\n                set [c_position v] to (((Clone ID) - ((_HUD_STAR ANIMATION) / (10))) - ((5) - ([p_ninja stars v] of [player v])))\n                go to x: ((-145) - (((C_Position) - (3)) * (18))) y: ((120) - (((C_Position) - (3)) * (1)))\n                point in direction ((90) - (((C_Position) - (3)) * (185)))\n                set [brightness v] effect to ((0) - (((C_Position) - (3)) * (10)))\n                set size to ((120) - ((C_Position) * (8))) %\n                if <((Clone ID) - (2)) < ((6) - ([p_ninja stars v] of [player v]))> then\n                    change x by ((_HUD_STAR ANIMATION) * (20))\n                    Ghost [100]\n                else\n                    Ghost (_HUD_GHOST)\n                end\n            end\n        end\n    end\n    if <(_GAME STATE) = [2]> then\n        hide\n    else\n        show\n    end\nend\n\ndefine HUD Ghost (ghost)\nset [_hud_ghost v] to ((_HUD_GHOST) - (((_HUD_GHOST) - (ghost)) / (4)))\n\ndefine Ghost (ghost)\nset [ghost v] to ((Ghost) - (((Ghost) - (ghost)) / (4)))\nset [ghost v] effect to (Ghost)\n\nwhen I receive [cutscene v]\nif <(_CUTSCENE) = [1]> then\n    set [ghost v] to [100]\n    set [ghost v] effect to (Ghost)\nend\n\nwhen I receive [attack v]\nset [_hud_show v] to [1]\nset [hud_ticks v] to [0]\n\n@Overlay\n\nwhen I receive [transition v]\nset [transition ticks v] to [20]\nset [ghost v] effect to (100)\nswitch costume to (white fader v)\nif <(Transition Type) = [1]> then\n    Go to: [600] [0]\nelse\n    if <(Transition Type) = [2]> then\n        Go to: [-600] [0]\n    else\n        if <(Transition Type) = [3]> then\n            Go to: [0] [500]\n        else\n            if <(Transition Type) = [4]> then\n                Go to: [0] [-500]\n            else\n                if <(Transition Type) = [5]> then\n                    switch costume to (black fader v)\n                    Go to: [0] [0]\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (sizer v)\nset size to (400) %\nswitch costume to (white fader v)\n\ndefine Go to: (x) (y)\nset [costume # v] to (costume [number v])\nswitch costume to (move v)\ngo to x: (x) y: (y)\nswitch costume to (Costume #)\n\nwhen I receive [tick v]\nif <(Transition Ticks) = [0]> then\n    hide\nelse\n    show\n    change [transition ticks v] by (-1)\n    if <(Transition Ticks) > [10]> then\n        change [ghost v] effect by (-15)\n        Smooth Move [0] [0]\n    else\n        change [ghost v] effect by (15)\n        if <(Transition Ticks) = [10]> then\n            set [level v] to (Transitioning Level)\n            broadcast (Load Level v)\n        end\n        if <(Transition Type) = [1]> then\n            Smooth Move [-700] [0]\n        else\n            if <(Transition Type) = [2]> then\n                Smooth Move [700] [0]\n            else\n                if <(Transition Type) = [3]> then\n                    Smooth Move [0] [-600]\n                else\n                    if <(Transition Type) = [4]> then\n                        Smooth Move [0] [600]\n                    else\n                        if <(Transition Type) = [5]> then\n                            Go to: [0] [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Smooth Move (x) (y)\nGo to: ((x position) - (((x position) - (x)) / (4))) ((y position) - (((y position) - (y)) / (4)))\n\nwhen I receive [cutscene v]\nif <(Cutscene) = [1]> then\n    Go to: [0] [0]\n    show\n    clear graphic effects\n    go to [front v] layer\n    switch costume to (sizer v)\n    set size to (400) %\n    switch costume to (black fader v)\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\nend\n\nwhen I receive [initial setup v]\nGo to: [0] [0]\nshow\nclear graphic effects\ngo to [front v] layer\nswitch costume to (sizer v)\nset size to (400) %\nswitch costume to (black fader v)\n\n@Breakable walls\n\nwhen I receive [position v]\nif <not <(Clone ID) = [0]>> then\n    set [costume # v] to (costume [number v])\n    switch costume to (move v)\n    go to x: (((MyX) + (((Shake) / (2)) * (Animation))) - (_CAMERA X)) y: ((MyY) - (_CAMERA Y))\n    switch costume to (Costume #)\nend\n\ndefine Clone (clones)\nset [clone id v] to [0]\nrepeat (clones)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone id v] to [0]\n\nwhen I receive [load level v]\nhide\nif <(Clone ID) = [0]> then\n    if <(_LEVEL) = [1]> then\n        set [_breakable walls v] to [2]\n        Clone [2]\n    end\nend\n\nwhen I start as a clone\nshow\ngo to [front v] layer\ngo [backward v] (25) layers\nset [health v] to [3]\nset [shake v] to [0]\nif <(Clone ID) = [1]> then\n    switch costume to (wall_block v)\n    set [myx v] to [1397]\n    set [myy v] to [184]\nelse\n    if <(Clone ID) = [2]> then\n        switch costume to (ceiling_block v)\n        set [myx v] to [1560]\n        set [myy v] to [237]\n    end\nend\n\nwhen I receive [tick v]\nDetect Hit\n\ndefine Detect Hit\nif <(Shake) = [0]> then\n    if <touching (attacks v)?> then\n        change [health v] by (-1)\n        set [shake v] to [10]\n        if <(Health) = [0]> then\n            change [_breakable walls v] by (-1)\n            delete this clone\n        end\n    end\nelse\n    change [shake v] by (-1)\n    if <(Animation) = [1]> then\n        set [animation v] to [-1]\n    else\n        set [animation v] to [1]\n    end\nend\n\n@Menu\n\ndefine Clone (clones)\nset [clone id v] to [0]\nrepeat (clones)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone id v] to [0]\n\nwhen I start as a clone\nif <(Clone ID) = [1]> then\n    switch costume to (test v)\n    forever\n        go to x: (-200) y: (-90)\n        if <touching (mouse-pointer v)?> then\n            set size to ((size) - (((size) - (110)) / (2))) %\n            if <mouse down?> then\n                set [_level v] to [X]\n                broadcast (Menu - Level v)\n            end\n        else\n            set size to ((size) - (((size) - (100)) / (2))) %\n        end\n    end\nelse\n    switch costume to (tutorial v)\n    forever\n        go to x: (-190) y: (-150)\n        if <touching (mouse-pointer v)?> then\n            set size to ((size) - (((size) - (110)) / (2))) %\n            if <mouse down?> then\n                set [_level v] to [1]\n                broadcast (Menu - Level v)\n            end\n        else\n            set size to ((size) - (((size) - (100)) / (2))) %\n        end\n    end\nend\n\nwhen I receive [menu - level v]\nhide\ndelete this clone\n\nwhen I receive [menu v]\nset [_game state v] to [2]\nset [_level v] to [0]\nswitch backdrop to (menu v)\nshow\nswitch costume to (ninja v)\nClone (2)\ngo to x: (0) y: (0)\nforever\n    wait (pick random (1) to (5)) seconds\n    if <(pick random (0) to (2)) = [1]> then\n        repeat (5)\n            wait (0) seconds\n            next costume\n        end\n        switch costume to (ninja v)\n    else\n        if <(pick random (0) to (1)) = [1]> then\n            switch costume to (n_look1 v)\n            repeat (2)\n                wait (0) seconds\n                next costume\n            end\n            wait (pick random (1) to (5)) seconds\n            repeat (3)\n                wait (0) seconds\n                next costume\n            end\n            switch costume to (ninja v)\n        else\n            switch costume to (n_observe1 v)\n            repeat (2)\n                wait (0) seconds\n                next costume\n            end\n            wait (pick random (1) to (3)) seconds\n            repeat (2)\n                wait (0) seconds\n                switch costume to ((costume [number v]) - (1))\n            end\n            switch costume to (ninja v)\n        end\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nswitch costume to (thumbnail v)\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\n\n
Welcome to Trolled!\n\nWatch out - even though the levels may seem easy, they all have hidden traps that will kill you. Good Luck!\n\nToo easy? Try https://scratch.mit.edu/projects/376400234/\n\nCoding 100% by me\nTitle from Cooltext.com\nAll other art by me\nMusic from Megaman