Battle 3 - Diamond Platformer Team

Instructions: Welcome to Battle 3\nPlease play this project through TurboWarp to enable full graphic effects: turbowarp.org/466099291?clones=Infinity\n\nwasd / arrow keys - move + wall jump\nspace - aim\nmouse click + space - shoot (while aiming)\nr - reload\nz - advance text\nl - toggle lag prevention\n\nq + green flag - start without resetting the character to the beginning of the level\n\nMusic:\nThe Black Pearl from Pirates of the Caribbean: The Curse of the Black Pearl by Klaus Badelt\nWalk The Plank from Pirates of the Caribbean: The Curse of the Black Pearl by Klaus Badelt\nOne Last Shot from Pirates of the Caribbean: The Curse of the Black Pearl by Klaus Badelt\nJack Sparrow from Pirates of the Caribbean: Dead Man's Chest by Hans Zimmer\n\nSound effects are either public domain or created by the Diamond Platformer Team.\n\nAll other assets created by the Diamond Platformer Team.\n\nBase Code update 1/5/2021

@Stage\n\nwhen flag clicked\nset volume to (100) %\nset [song v] to [1]\nforever\n    wait until <not <[0] = (Song)>>\n    set volume to (100) %\n    play sound (Song) until done\nend\n\nwhen flag clicked\nwait until <[1670] > (Player x)>\nwait until <[1670] < (Player x)>\nFade\nwait until <[2222] < (Player x)>\nset [song v] to [2]\nwait until <[5000] < (Player x)>\nFade\nwait until \nset [song v] to [1]\nwait until <[2] = (item (3) of [goal progress v])>\nFade\nwait until \nset [song v] to [4]\n\ndefine Fade\nset [song v] to [0]\nrepeat (20)\n    change volume by (-4)\nend\nstop all sounds\n\n@Game Operator\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\n\nwhen [l v] key pressed\nset [lag reduction v] to (((1) + (Lag Reduction)) mod (2))\n\ndefine Find Undead Character\nset [character index v] to ((22) * ((-1) + (pick random (1) to ((length of [character segment positions v]) / (22)))))\nrepeat until <[0] < (item ((22) + (Character Index)) of [character segment positions v])>\n    set [character index v] to ((22) * ((-1) + (pick random (1) to ((length of [character segment positions v]) / (22)))))\nend\n\nwhen I receive [start v]\nbroadcast (Initialize v) and wait\nset [level timer v] to [0]\nset [screen x v] to [-350]\nset [screen y v] to [1000]\nset [screen size v] to [0.8]\nset [dialogue mode? v] to [0]\nset [destroy all enemies? v] to [0]\nset [dead? v] to [0]\nset [i v] to [0]\nset [i2 v] to [0.8]\nset [hitbox x v] to [0]\nset [hitbox y v] to [0]\nset [clone count v] to [0]\nbroadcast (Clone v) and wait\nif <not <key (q v) pressed?>> then\n    broadcast (Dialogue v)\nend\nforever\n    change [game counter v] by (1)\n    change [level timer v] by (1)\n    Screen Movement\n    broadcast (Frame v)\n    if <<[120] < ([abs v] of (((Player x) - (Hitbox x)) * (Hitbox size)) )> or <[90] < ([abs v] of (((Player y) - (Hitbox y)) * (Hitbox size)) )>> then\n        set [new hitbox x v] to (Player x)\n        set [new hitbox y v] to (Player y)\n        set [new hitbox size v] to (Hitbox size)\n        broadcast (Realign Hitbox v)\n    end\n    set [_mousex v] to ((Screen x) + ((mouse x) / (Screen Size)))\n    set [_mousey v] to ((Screen y) + ((mouse y) / (Screen Size)))\nend\n\nwhen flag clicked\nbroadcast (Start v)\n\ndefine Screen glide towards x: (x) y: (y) size: (size) x glide factor (between 0 and 1) (x coefficient) y glide factor (between 0 and 1) (y coefficient)\nset [screen x v] to (((x) * (x coefficient)) + ((Screen x) * ((1) - (x coefficient))))\nset [screen y v] to (((y) * (y coefficient)) + ((Screen y) * ((1) - (y coefficient))))\nset [screen size v] to (((size) * (x coefficient)) + ((Screen Size) * ((1) - (x coefficient))))\n\ndefine Screen Movement\nif <[0] = (Dead?)> then\n    if <[0] = (Dialogue Mode?)> then\n        if <[1] = (Camera Follow Type)> then\n            show variable [screen x v]\n            show variable [screen y v]\n        else\n            hide variable [screen x v]\n            hide variable [screen y v]\n            if <[2] = (Camera Follow Type)> then\n                if <key (space v) pressed?> then\n                    Screen glide towards x: ((Player x) + ((0.3) * (mouse x))) y: (((30) + (Player y)) + ((0.3) * (mouse y))) size: [0.8] x glide factor (between 0 and 1) [0.6] y glide factor (between 0 and 1) [0.1]\n                else\n                    Screen glide towards x: (Player x) y: ((30) + (Player y)) size: [0.8] x glide factor (between 0 and 1) [0.6] y glide factor (between 0 and 1) [0.1]\n                end\n            end\n            if <[3] = (Camera Follow Type)> then\n                Screen glide towards x: (mouse x) y: (mouse y) size: (Screen Size) x glide factor (between 0 and 1) [0.3] y glide factor (between 0 and 1) [0.3]\n            end\n        end\n    else\n        Screen glide towards x: (item ((20) + (item ((3) + (Line Index)) of [text v])) of [character segment positions v]) y: (item ((21) + (item ((3) + (Line Index)) of [text v])) of [character segment positions v]) size: [2] x glide factor (between 0 and 1) [0.2] y glide factor (between 0 and 1) [0.2]\n    end\nelse\n    change [i v] by [1]\n    if <[150] = (i)> then\n        Find Undead Character\n        set [i2 v] to ((pick random (0.5) to (2)) * (pick random (0.0) to (1)))\n        if <[0.25] > (i2)> then\n            set [i2 v] to [0.25]\n        end\n        set [i v] to [0]\n    end\n    Screen glide towards x: (item ((20) + (Character Index)) of [character segment positions v]) y: (item ((21) + (Character Index)) of [character segment positions v]) size: (i2) x glide factor (between 0 and 1) [0.05] y glide factor (between 0 and 1) [0.05]\nend\n\n@Clones\n\ndefine Add Clone | x: (x) y: (y) size: (size) type: (type)\nset [clone x v] to (x)\nset [clone y v] to (y)\nset [clone size v] to ((size) / (100))\nset [clone costume v] to (costume [name v])\nset [clone type v] to (type)\ncreate clone of (_myself_ v)\nset [clone type v] to [Not a Clone]\n\nwhen I receive [frame v]\nif <[Parallax] = (Clone type)> then\n    Set Size to ((100) * ((Clone size) * (Screen Size))) Unlimited\n    go to x: ((((Clone x) - (Screen x)) * (Clone Paralax Depth)) * (Screen Size)) y: ((((Clone y) - (Screen y)) * (Clone Paralax Depth)) * (Screen Size)) and hide if offscreen\nelse\n    if <[Parallax Horizon] = (Clone type)> then\n        Set Size to [100] Unlimited\n        go to x: [0] y: ((((Clone y) - (Screen y)) * (Clone Paralax Depth)) * (Screen Size)) and hide if offscreen\n    else\n        if <not <<[-] = (letter (1) of (Clone type))> or <[Not a Clone] = (Clone type)>>> then\n            Set Size to ((100) * ((Clone size) * (Screen Size))) Unlimited\n            go to x: (((Clone x) - (Screen x)) * (Screen Size)) y: (((Clone y) - (Screen y)) * (Screen Size)) and hide if offscreen\n        end\n    end\nend\n\nwhen I receive [clone v]\npoint in direction (90)\nset rotation style [all around v]\nreset timer\nshow\nset [gray? v] to [0]\ndelete all of [character segment positions v]\ndelete all of [swing bars v]\nClone Parallax\nClone Objects\nClone Ground\nhide\n\ndefine Add Parallax Layer | x: (x) y: (y) depth (between 0 and 1): (depth coefficient) size: (size)\nset [clone x v] to (x)\nset [clone y v] to (y)\nset [clone paralax depth v] to (depth coefficient)\nset [clone size v] to ((size) / (100))\nset [clone type v] to [Parallax]\nset [clone costume v] to (costume [name v])\ncreate clone of (_myself_ v)\nset [clone type v] to [Not a Clone]\n\ndefine Set Size to (size) Unlimited\nif <(size) > [100]> then\n    set [clone costume v] to (costume [name v])\n    switch costume to (>100 sizer v)\n    set size to (size) %\n    switch costume to (Clone costume)\nelse\n    set size to (size) %\nend\n\ndefine go to x: (x) y: (y) and hide if offscreen\ngo to x: (x) y: (y)\nif <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>> then\n    show\nelse\n    hide\nend\n\ndefine Clone Parallax\nswitch costume to (parallax layer 1 v)\nAdd Parallax Layer | x: [1000] y: [-25] depth (between 0 and 1): [0.15] size: [200]\nswitch costume to (parallax horizon v)\nAdd Parallax Horizon | y: [-25] depth (0-1): [0.15]\nswitch costume to (parallax layer 2 v)\nAdd Parallax Layer | x: [1150] y: [-50] depth (between 0 and 1): [0.25] size: [200]\nswitch costume to (parallax layer 3 v)\nAdd Parallax Layer | x: [8100] y: [1200] depth (between 0 and 1): [0.8] size: [200]\nswitch costume to (player ship 1 parallax v)\nAdd Parallax Layer | x: [-1000] y: [-180] depth (between 0 and 1): [1] size: [300]\nParallax [400] [0] [0]\n\ndefine Clone Ground\nswitch costume to (player ship 1 v)\nAdd Clone | x: [-1000] y: [-180] size: [300] type: []\nLevel [400] [0] [0]\n\ndefine Clone Objects\nset [clone x velocity v] to [0]\nset [clone y velocity v] to [0]\nif <is compiled?> then\n    Add Wall Torch | x: [2350] y: [-250] activation x: [2222]\n    Add Wall Torch | x: [5022] y: [70] activation x: [4770]\n    Add Wall Torch | x: [6730] y: [430] activation x: [6552]\nend\nif <key (q v) pressed?> then\n    Add Character | x: (Player x) y: (Player y) costume prefix: [PC] weapon: []\nelse\n    Add Character | x: [-740] y: [-160] costume prefix: [PC] weapon: []\nend\nset [player x v] to [0]\nset [player y v] to [0]\nAdd Character | x: [-830] y: [-160] costume prefix: [BG] weapon: []\nswitch costume to (swing bar v)\nAdd Clone | x: [5220] y: [90] size: [100] type: [Swing Bar]\nAdd Clone | x: [5410] y: [130] size: [100] type: [Swing Bar]\nAdd Clone | x: [5600] y: [170] size: [100] type: [Swing Bar]\nAdd Clone | x: [5780] y: [210] size: [100] type: [Swing Bar]\nAdd Clone | x: [5960] y: [250] size: [100] type: [Swing Bar]\nAdd Clone | x: [6140] y: [290] size: [100] type: [Swing Bar]\nswitch costume to (swing bar no base v)\nAdd Clone | x: [8000] y: [1180] size: [100] type: [Swing Bar]\nAdd Clone | x: [8220] y: [1180] size: [100] type: [Swing Bar]\nSet Enemy Wake-Up X and Respawn Time [2222] [25]\nAdd Character | x: [2640] y: [-200] costume prefix: [SW] weapon: [Knife]\nAdd Character | x: [2650] y: [-200] costume prefix: [SW] weapon: [Knife]\nAdd Character | x: [2660] y: [-200] costume prefix: [SW] weapon: [Sword]\nSet Enemy Wake-Up X and Respawn Time [5060] [15]\nAdd Character | x: [5500] y: [-200] costume prefix: [SW] weapon: [Sword]\nAdd Character | x: [5560] y: [0] costume prefix: [SW] weapon: [Pin]\nAdd Character | x: [4900] y: [340] costume prefix: [SW] weapon: [Knife]\nSet Enemy Wake-Up X and Respawn Time [7550] [5]\nAdd Character | x: [8160] y: [1050] costume prefix: [SW] weapon: [Pin]\nAdd Character | x: [8110] y: [1100] costume prefix: [SW] weapon: [Knife]\nAdd Character | x: [8060] y: [1050] costume prefix: [SW] weapon: [Sword]\nswitch costume to (talisman v)\nAdd Talisman | x y health [8108] [1200] [2000]\n\ndefine Check for Ground Collision at x: (x) y: (y) size: (size)\nset size to ((100) * ((size) * (Hitbox size))) %\ngo to x: (((x) - (Hitbox x)) * (Hitbox size)) y: (((y) - (Hitbox y)) * (Hitbox size))\nshow\nset [ground? v] to <touching (ground hitbox v)?>\n\ndefine Player Physics | acceleration (acceleration) friction (between 0 and 1) (friction) jump height (jump height) gravity (gravity) key inputs (right, left, up) <right> <left> <up> player? (true/false) (player?) wall jump <wall jump>\nset rotation style [don't rotate v]\nswitch costume to (character hitbox v)\nif <[0] = (suspend x controls)> then\n    change [clone x velocity v] by ((acceleration) * (<right> - <left>))\n    set [clone x velocity v] to ((Clone x velocity) * (friction))\nelse\n    change [suspend x controls v] by (-1)\n    if <[0] > (suspend x controls)> then\n        set [suspend x controls v] to [0]\n    end\nend\nCheck for Ground Collision at x: ((Clone x) + (Clone x velocity)) y: (Clone y) size: (Clone size)\nif <[true] = (Ground?)> then\n    if <(Clone y velocity) < [0]> then\n        Slope Detection | iterations: ([ceiling v] of (([abs v] of (Clone x velocity) ) / ((4) * (Hitbox size))) ) iteration height: [1]\n    end\n    if <[true] = (Ground?)> then\n        set [clone x velocity v] to ((Clone x velocity) * (0.2))\n        if <<wall jump> and <[7] < (fall counter)>> then\n            switch costume to (character foot hitbox v)\n            Check for Ground Collision at x: ((Clone x) + ((Clone x velocity) / (0.2))) y: (Clone y) size: (Clone size)\n            if <[true] = (Ground?)> then\n                if <(Clone x velocity) > [0]> then\n                    set [clone x velocity v] to [-15]\n                else\n                    set [clone x velocity v] to [12]\n                end\n                set [clone y velocity v] to [30]\n                set [suspend x controls v] to [11]\n                set [wall jump v] to [1]\n                set [jump used? v] to [2]\n            end\n            switch costume to (character hitbox v)\n        end\n    else\n        set [distance v] to ([sqrt v] of (((slope height) * (slope height)) + ((Clone x velocity) * (Clone x velocity))) )\n        if <(Clone x velocity) > [0]> then\n            change [clone x v] by (((Clone x velocity) * (Clone x velocity)) / (distance))\n            change [clone y v] by ((slope height) * (((Clone x velocity) / (distance)) - (1)))\n        else\n            change [clone x v] by ((0) - (((Clone x velocity) * (Clone x velocity)) / (distance)))\n            change [clone y v] by ((slope height) * ((((0) - (Clone x velocity)) / (distance)) - (1)))\n        end\n    end\nelse\n    change [clone x v] by (Clone x velocity)\nend\nset [x colision? v] to (Ground?)\nchange [clone y velocity v] by (gravity)\nset [clone y velocity v] to ((Clone y velocity) * (0.98))\nCheck for Ground Collision at x: (Clone x) y: ((Clone y) + (Clone y velocity)) size: (Clone size)\nset [y colision? v] to (Ground?)\nif <[true] = (Ground?)> then\n    if <(Clone y velocity) < [0]> then\n        set [fall counter v] to [0]\n    else\n        set [fall counter v] to [4]\n    end\n    if <(Clone y velocity) < [-3.5]> then\n        Slope Detection | iterations: (round ([abs v] of (((10) * (Clone y velocity)) / (Hitbox size)) )) iteration height: [0.1]\n    end\n    set [clone y velocity v] to ((Clone y velocity) * (0.1))\nelse\n    change [fall counter v] by (1)\n    change [clone y v] by (Clone y velocity)\nend\nif <[4] > (fall counter)> then\n    set [y colision? v] to [true]\n    if <up> then\n        set [clone y velocity v] to (jump height)\n        set [fall counter v] to [4]\n        set [jump used? v] to [1]\n    end\nend\nif <(player?) = [true]> then\n    set [player x v] to (Clone x)\n    set [player y v] to (Clone y)\n    set [player health v] to (item ((22) + (Clone Character index)) of [character segment positions v])\nend\npoint in direction (Clone x velocity)\nswitch costume to (Clone costume)\nset rotation style [left-right v]\n\ndefine Slope Detection | iterations: (iterations) iteration height: (height)\nset [i v] to [0]\nset [ground? v] to [true]\nrepeat until <<[false] = (Ground?)> or <(i) = (iterations)>>\n    change y by (height)\n    change [i v] by (1)\n    set [ground? v] to <touching (ground hitbox v)?>\nend\nif <[false] = (Ground?)> then\n    set [slope height v] to (((i) * (height)) / (Hitbox size))\n    set [clone y v] to (((y position) / (Hitbox size)) + (Hitbox y))\nend\n\ndefine find distance to player\nset [distance v] to ([sqrt v] of ((((Player x) - (Clone x)) * ((Player x) - (Clone x))) + (((Player y) - (Clone y)) * ((Player y) - (Clone y)))) )\n\nwhen I start as a clone\nchange [clone count v] by (1)\nif <[0] = (Gray?)> then\n    if <[-Character Manager] = (Clone type)> then\n        set [ghost v] effect to (100)\n        if <[PC] = (Clone Character Prefix)> then\n            forever\n                if <not <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n                    set [jump used? v] to <<[0] = (Jump Used?)> and <[0] = (Jump Used?)>>\n                end\n                if <[0] = (swing state)> then\n                    if <[0] = (Dialogue Mode?)> then\n                        Player Physics | acceleration [3.5] friction (between 0 and 1) [0.7] jump height [30] gravity [-3] key inputs (right, left, up) <<key (right arrow v) pressed?> or <key (d v) pressed?>> <<key (left arrow v) pressed?> or <key (a v) pressed?>> <<key (up arrow v) pressed?> or <key (w v) pressed?>> player? (true/false) [true] wall jump <<[0] > (Clone y velocity)> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>>\n                    else\n                        Player Physics | acceleration [3.5] friction (between 0 and 1) [0.7] jump height [30] gravity [-3] key inputs (right, left, up) <> <> <> player? (true/false) [true] wall jump <>\n                    end\n                    set [swinging? v] to [0]\n                else\n                    set [swinging? v] to [1]\n                    if <not <[0] = (suspend x controls)>> then\n                        change [suspend x controls v] by (-1)\n                        if <[0] > (suspend x controls)> then\n                            set [suspend x controls v] to [0]\n                        end\n                    end\n                end\n                if <[1] = (Reload)> then\n                    set [swinging? v] to [1]\n                end\n                if <[1] < (timer)> then\n                    Swing Bar\n                end\n                Set Leg Angles | thigh length: [25] calf length: [25] hip y: ((-35) + ((-0.3) * (([abs v] of (Clone x velocity) ) * ([cos v] of ((Clone x) * ((360) / (stride length))) )))) slope: (slope) index: (Clone Character index) jumping? <not <[4] > (fall counter)>> wall jumping? <[1] = (wall jump)> xvel / max xvel ((Clone x velocity) / (10)) right/left (1/-1) ((-1) + ((2) * <(mouse x) > (((Clone x) - (Screen x)) * (Screen Size))>)) swing state (swing state) swing direction (swing direction) attack type [0] attack counter [0]\n                replace item ((20) + (Clone Character index)) of [character segment positions v] with (Clone x)\n                replace item ((21) + (Clone Character index)) of [character segment positions v] with (Clone y)\n                set [player x v] to (Clone x)\n                set [player y v] to (Clone y)\n                if <(Player Health) = (Previous Health)> then\n                    change [health counter v] by [1]\n                    if <[60] < (Health Counter)> then\n                        replace item ((22) + (Clone Character index)) of [character segment positions v] with ((0.25) + (item ((22) + (Clone Character index)) of [character segment positions v]))\n                        if <[100] < (item ((22) + (Clone Character index)) of [character segment positions v])> then\n                            replace item ((22) + (Clone Character index)) of [character segment positions v] with [100]\n                        end\n                        set [player health v] to (item ((22) + (Clone Character index)) of [character segment positions v])\n                        set [previous health v] to (Player Health)\n                    end\n                else\n                    set [previous health v] to (Player Health)\n                    set [health counter v] to [0]\n                end\n                if <not <[0] < (Player Health)>> then\n                    set [dead? v] to [1]\n                    broadcast (Dead v)\n                end\n            end\n        else\n            if <[SW] = (Clone Character Prefix)> then\n                set [attack type v] to [1]\n                NPC AI Package | left/right jump wall_jump friendly? [-1] <> <> []\n                wait until <(Player x) > (Clone base x)>\n                forever\n                    if <[-70] > ((Player x) - (Clone x))> then\n                        repeat until <not <[-70] > ((Player x) - (Clone x))>>\n                            NPC AI Package | left/right jump wall_jump friendly? [1] <<<[true] = (x colision?)> or <[2] = (fall counter)>> or <[1] = (pick random (1) to (60))>> <[10] < (x collision counter)> []\n                        end\n                        if <[70] < ((Player y) - (Clone y))> then\n                            set [state counter v] to [60]\n                            repeat until <<[true] = (x colision?)> or <[0] = (state counter)>>\n                                change [state counter v] by (-1)\n                                NPC AI Package | left/right jump wall_jump friendly? [1] <[2] = (fall counter)> <> []\n                            end\n                            if <[true] = (x colision?)> then\n                                repeat until <[0] < (Clone y velocity)>\n                                    NPC AI Package | left/right jump wall_jump friendly? [1]  <> []\n                                end\n                                repeat until <[0] > (Clone y velocity)>\n                                    NPC AI Package | left/right jump wall_jump friendly? [1] <> <> []\n                                end\n                                NPC AI Package | left/right jump wall_jump friendly? [1] <>  []\n                            end\n                        else\n                            if <[-70] > ((Player y) - (Clone y))> then\n                                set [state counter v] to [60]\n                                repeat until <<[true] = (x colision?)> or <[0] = (state counter)>>\n                                    change [state counter v] by (-1)\n                                    NPC AI Package | left/right jump wall_jump friendly? [1] <> <> []\n                                end\n                            end\n                        end\n                    else\n                        if <[70] < ((Player x) - (Clone x))> then\n                            repeat until <not <[70] < ((Player x) - (Clone x))>>\n                                NPC AI Package | left/right jump wall_jump friendly? [-1] <<<[true] = (x colision?)> or <[2] = (fall counter)>> or <[1] = (pick random (1) to (60))>> <[10] < (x collision counter)> []\n                            end\n                            if <[70] < ((Player y) - (Clone y))> then\n                                set [state counter v] to [60]\n                                repeat until <<[true] = (x colision?)> or <[0] = (state counter)>>\n                                    change [state counter v] by (-1)\n                                    NPC AI Package | left/right jump wall_jump friendly? [-1] <[2] = (fall counter)> <> []\n                                end\n                                if <[true] = (x colision?)> then\n                                    repeat until <[0] < (Clone y velocity)>\n                                        NPC AI Package | left/right jump wall_jump friendly? [-1]  <> []\n                                    end\n                                    repeat until <[0] > (Clone y velocity)>\n                                        NPC AI Package | left/right jump wall_jump friendly? [-1] <> <> []\n                                    end\n                                    NPC AI Package | left/right jump wall_jump friendly? [-1] <>  []\n                                end\n                            else\n                                if <[-70] > ((Player y) - (Clone y))> then\n                                    set [state counter v] to [60]\n                                    repeat until <<[true] = (x colision?)> or <[0] = (state counter)>>\n                                        change [state counter v] by (-1)\n                                        NPC AI Package | left/right jump wall_jump friendly? [-1] <> <> []\n                                    end\n                                end\n                            end\n                        else\n                            NPC AI Package | left/right jump wall_jump friendly? [0] <> <> []\n                        end\n                    end\n                end\n            else\n                if <[BG] = (Clone Character Prefix)> then\n                    replace item ((22) + (Clone Character index)) of [character segment positions v] with [100]\n                    forever\n                        NPC AI Package | left/right jump wall_jump friendly? [0] <> <> [1]\n                    end\n                end\n            end\n        end\n    end\n    if <[Character Segment] = (Clone type)> then\n        if <[SW] = (Clone Character Prefix)> then\n            forever\n                if <[6] = (Clone Character Segment ID)> then\n                    repeat until <not <[20] < (item ((22) + (Clone Character index)) of [character segment positions v])>>\n                        Character | x: (item ((20) + (Clone Character index)) of [character segment positions v]) y: (item ((21) + (Clone Character index)) of [character segment positions v]) slope: [] index: (Clone Character index)\n                    end\n                else\n                    repeat until <not <[0] < (item ((22) + (Clone Character index)) of [character segment positions v])>>\n                        Character | x: (item ((20) + (Clone Character index)) of [character segment positions v]) y: (item ((21) + (Clone Character index)) of [character segment positions v]) slope: [] index: (Clone Character index)\n                    end\n                end\n                set [clone x velocity v] to (pick random (-10) to (10))\n                set [clone y velocity v] to (pick random (-3) to (25))\n                repeat until <<[20] < (item ((22) + (Clone Character index)) of [character segment positions v])> or <[1] = (Destroy All Enemies?)>>\n                    turn right ((2) * (Clone x velocity)) degrees\n                    Object Physics | gravity [-3] collision coefficient (-1 to 1, negative for bounce) [-0.75] ground friction [0.7]\n                end\n                repeat (pick random (0) to (15))\n                    turn right ((2) * (Clone x velocity)) degrees\n                    Object Physics | gravity [-3] collision coefficient (-1 to 1, negative for bounce) [-0.75] ground friction [0.7]\n                end\n                if <[1] = (Destroy All Enemies?)> then\n                    repeat (20)\n                        turn right ((2) * (Clone x velocity)) degrees\n                        Object Physics | gravity [-3] collision coefficient (-1 to 1, negative for bounce) [-0.75] ground friction [0.7]\n                        change [ghost v] effect by (5)\n                    end\n                    change [clone count v] by (-1)\n                    delete this clone\n                end\n                set [clone character assemble v] to [20]\n                repeat (20)\n                    set [clone base x v] to (Clone x)\n                    set [clone base y v] to (Clone y)\n                    set [clone base dir v] to (direction)\n                    Character | x: (item ((20) + (Clone Character index)) of [character segment positions v]) y: (item ((21) + (Clone Character index)) of [character segment positions v]) slope: [] index: (Clone Character index)\n                    set [clone x v] to ((Clone base x) + (((Clone x) - (Clone base x)) / (Clone Character Assemble)))\n                    set [clone y v] to ((Clone base y) + (((Clone y) - (Clone base y)) / (Clone Character Assemble)))\n                    point in direction ((Clone base dir) + (((direction) - (Clone base dir)) / (Clone Character Assemble)))\n                    change [clone character assemble v] by (-1)\n                end\n            end\n        else\n            forever\n                Character | x: (item ((20) + (Clone Character index)) of [character segment positions v]) y: (item ((21) + (Clone Character index)) of [character segment positions v]) slope: [] index: (Clone Character index)\n            end\n        end\n    end\n    if <[Chick] = (Clone type)> then\n        forever\n            repeat until <[150] < (Clone x)>\n                Player Physics | acceleration [5] friction (between 0 and 1) [0.7] jump height [30] gravity [-3] key inputs (right, left, up)  <> <[true] = (x colision?)> player? (true/false) [false] wall jump <>\n                store clone coordinates in list at index: [1]\n            end\n            repeat (30)\n                Player Physics | acceleration [5] friction (between 0 and 1) [0.7] jump height [30] gravity [-3] key inputs (right, left, up) <> <> <> player? (true/false) [false] wall jump <>\n            end\n            repeat until <[-300] > (Clone x)>\n                Player Physics | acceleration [5] friction (between 0 and 1) [0.7] jump height [30] gravity [-3] key inputs (right, left, up) <>  <[true] = (x colision?)> player? (true/false) [false] wall jump <>\n                store clone coordinates in list at index: [1]\n            end\n            repeat (30)\n                Player Physics | acceleration [5] friction (between 0 and 1) [0.7] jump height [30] gravity [-3] key inputs (right, left, up) <> <> <> player? (true/false) [false] wall jump <>\n            end\n        end\n    end\n    if <[Point towards Clone] = (Clone type)> then\n        forever\n            find distance and direction to coordinates in list at index: [1]\n            point in direction (direction)\n        end\n    end\n    if <[Floating Collectable] = (Clone type)> then\n        set [clone base y v] to (Clone y)\n        forever\n            set [clone y v] to ((Clone base y) + ((10) * ([sin v] of ((Clone x) + ((10) * (Game Counter))) )))\n            find distance to player\n            if <(distance) < [75]> then\n                start sound [Coin v]\n                repeat (15)\n                    change [ghost v] effect by (6.7)\n                    change [clone y v] by (2)\n                    change [clone size v] by (-0.001)\n                end\n                change [clone count v] by (-1)\n                delete this clone\n            end\n        end\n    end\n    if <[Bullet] = (Clone type)> then\n        start sound (join [F] ([floor v] of (Bullet Cycle) ))\n        if <[R] = (letter (length of (costume [name v])) of (costume [name v]))> then\n            switch costume to (+ v)\n        else\n            switch costume to (- v)\n        end\n        change [clone x v] by ((45) * ([sin v] of ((90) + (direction)) ))\n        change [clone y v] by ((45) * ([cos v] of ((90) + (direction)) ))\n        repeat (60)\n            change [clone x v] by ((20) * ([sin v] of ((90) + (direction)) ))\n            change [clone y v] by ((20) * ([cos v] of ((90) + (direction)) ))\n            Check for Ground Collision at x: (Clone x) y: (Clone y) size: (Clone size)\n            hide\n            if <[1] = (Ground?)> then\n                change [clone count v] by (-1)\n                delete this clone\n            end\n            Check for Character at x: (Clone x) y: (Clone y) ignore index: (Clone Character index)\n            if <not <[-1] = (i)>> then\n                if <[6] < ((Clone y) - (item ((21) + (i)) of [character segment positions v]))> then\n                    replace item ((22) + (i)) of [character segment positions v] with ((-80) + (item ((22) + (i)) of [character segment positions v]))\n                else\n                    if <[-25] < ((Clone y) - (item ((21) + (i)) of [character segment positions v]))> then\n                        replace item ((22) + (i)) of [character segment positions v] with ((-100) + (item ((22) + (i)) of [character segment positions v]))\n                    else\n                        replace item ((22) + (i)) of [character segment positions v] with ((-50) + (item ((22) + (i)) of [character segment positions v]))\n                    end\n                end\n                change [clone count v] by (-1)\n                delete this clone\n            end\n        end\n        change [clone count v] by (-1)\n        delete this clone\n    end\n    if <[Smoke Particle] = (Clone type)> then\n        switch costume to (smoke particle v)\n        set [clone size v] to [0.65]\n        turn right (90) degrees\n        change [clone x v] by ((80) * ([sin v] of (direction) ))\n        change [clone y v] by ((80) * ([cos v] of (direction) ))\n        turn right (pick random (-20) to (20)) degrees\n        set [velocity v] to (pick random (0.0) to (1))\n        set [velocity v] to ((10) * ((1) - (([sqrt v] of (velocity) ) * (velocity))))\n        set [clone x velocity v] to ((velocity) * ([sin v] of (direction) ))\n        set [clone y velocity v] to ((velocity) * ([cos v] of (direction) ))\n        set [ghost v] effect to (0)\n        repeat (100)\n            set [clone x velocity v] to ((0.95) * (Clone x velocity))\n            set [clone y velocity v] to ((0.1) + ((0.95) * (Clone y velocity)))\n            change [clone x v] by (Clone x velocity)\n            change [clone y v] by (Clone y velocity)\n            change [clone size v] by (((((6) + (velocity)) * (0.6)) * (pick random (2) to (5))) / (100))\n            change [ghost v] effect by (pick random (0) to (5))\n        end\n        change [clone count v] by (-1)\n        delete this clone\n    end\n    if <[Fire Particle] = (Clone type)> then\n        if <[0] = (Preset Fire?)> then\n            go [forward v] (1) layers\n            switch costume to (fire 1 v)\n            set [clone x velocity v] to (pick random (-0.8) to (0.8))\n            change [clone x v] by (pick random (-2.0) to (2.0))\n            point in direction (pick random (-180) to (180))\n            set [brightness v] effect to (pick random (60) to (85))\n            show\n            set [preset fire? v] to [1]\n            create clone of (_myself_ v)\n            set [preset fire? v] to [0]\n        else\n            switch costume to (fire 2 v)\n        end\n        hide\n        repeat ((12.5) * ((1) + (Preset Fire?)))\n            set [clone x velocity v] to ((1.01) * (Clone x velocity))\n            change [clone size v] by [0.04]\n            change [clone x v] by (Clone x velocity)\n            change [clone y v] by [3]\n            turn left ((10) * (Clone x velocity)) degrees\n            change [brightness v] effect by (-10)\n            change [color v] effect by (-1)\n            change [ghost v] effect by ((4) * ((2) - (Preset Fire?)))\n        end\n        change [clone count v] by (-1)\n        delete this clone\n    end\n    if <[Torch] = (Clone type)> then\n        wait until <(Player x) > (Clone base x)>\n        forever\n            if <<[0] = (Lag Reduction)> and <<[180] > ([abs v] of (((Clone x) - (Hitbox x)) * (Hitbox size)) )> and <[120] > ([abs v] of (((Clone y) - (Hitbox y)) * (Hitbox size)) )>>> then\n                set [clone type v] to [Fire Particle]\n                create clone of (_myself_ v)\n                set [clone type v] to [Torch]\n            end\n        end\n    end\n    if <[Torch Light] = (Clone type)> then\n        set [ghost v] effect to (100)\n        wait until <(Player x) > (Clone base x)>\n        if <[0] = (Lag Reduction)> then\n            repeat (20)\n                set [clone size v] to (pick random (0.8) to (0.92))\n                change [ghost v] effect by (-5)\n                set [color v] effect to (pick random (-1.5) to (1.5))\n                set [brightness v] effect to (pick random (-3.0) to (3.0))\n            end\n        end\n        forever\n            if <<[0] = (Lag Reduction)> and <<[180] > ([abs v] of (((Clone x) - (Hitbox x)) * (Hitbox size)) )> and <[120] > ([abs v] of (((Clone y) - (Hitbox y)) * (Hitbox size)) )>>> then\n                set [clone size v] to (pick random (0.8) to (0.92))\n                set [ghost v] effect to (pick random (0.0) to (10))\n                set [color v] effect to (pick random (-1.5) to (1.5))\n                set [brightness v] effect to (pick random (-3.0) to (3.0))\n            end\n        end\n    end\n    if <[Talisman] = (Clone type)> then\n        set [clone x velocity v] to [120]\n        set [clone y velocity v] to [0]\n        set [clone base x v] to (Clone x)\n        set [clone base y v] to (Clone y)\n        set [previous health v] to (item ((22) + (Clone Character index)) of [character segment positions v])\n        forever\n            change [clone x velocity v] by (1)\n            set [clone x v] to ((Clone base x) + ((250) * ([sin v] of (Clone x velocity) )))\n            set [clone y v] to ((Clone base y) + ((250) * ([cos v] of (Clone x velocity) )))\n            replace item ((20) + (Clone Character index)) of [character segment positions v] with (Clone x)\n            replace item ((21) + (Clone Character index)) of [character segment positions v] with (Clone y)\n            point in direction ((90) + ((30) * ([sin v] of ((5) * (Clone x velocity)) )))\n            set [brightness v] effect to ((Clone y velocity) + ((100) - ((item ((22) + (Clone Character index)) of [character segment positions v]) / (20))))\n            set [clone y velocity v] to ((0.9) * (Clone y velocity))\n            if <(Previous Health) = (item ((22) + (Clone Character index)) of [character segment positions v])> then\n                change [health counter v] by [1]\n                if <[60] < (Health Counter)> then\n                    replace item ((22) + (Clone Character index)) of [character segment positions v] with ((0.25) + (item ((22) + (Clone Character index)) of [character segment positions v]))\n                    if <[2000] < (item ((22) + (Clone Character index)) of [character segment positions v])> then\n                        replace item ((22) + (Clone Character index)) of [character segment positions v] with [2000]\n                    end\n                    set [previous health v] to (item ((22) + (Clone Character index)) of [character segment positions v])\n                end\n            else\n                set [previous health v] to (item ((22) + (Clone Character index)) of [character segment positions v])\n                set [health counter v] to [0]\n                change [clone y velocity v] by [10]\n            end\n            if <[0] > (item ((22) + (Clone Character index)) of [character segment positions v])> then\n                set [destroy all enemies? v] to [1]\n                repeat (20)\n                    set [clone size v] to ((1.2) * (Clone size))\n                    turn right (15) degrees\n                    change [ghost v] effect by (5)\n                end\n                change [clone count v] by (-1)\n                delete this clone\n            end\n        end\n    end\n    if <[Swing Bar] = (Clone type)> then\n        add (Clone x) to [swing bars v]\n        add (Clone y) to [swing bars v]\n    end\nelse\n    if <[Character Segment] = (Clone type)> then\n        wait (0.2) seconds\n        Character | x: (item ((20) + (Clone Character index)) of [character segment positions v]) y: (item ((21) + (Clone Character index)) of [character segment positions v]) slope: [] index: (Clone Character index)\n    end\nend\n\ndefine find distance and direction to coordinates in list at index: (index)\nset [distance v] to ([sqrt v] of ((((Clone x) - (item ((1) + ((2) * ((-1) + (index)))) of [clone coordinates v])) * ((Clone x) - (item ((1) + ((2) * ((-1) + (index)))) of [clone coordinates v]))) + (((Clone y) - (item ((2) + ((2) * ((-1) + (index)))) of [clone coordinates v])) * ((Clone y) - (item ((2) + ((2) * ((-1) + (index)))) of [clone coordinates v])))) )\nif <[0] < ((Clone y) - (item ((2) + ((2) * ((-1) + (index)))) of [clone coordinates v]))> then\n    set [direction v] to ((180) + ([asin v] of (((Clone x) - (item ((1) + ((2) * ((-1) + (index)))) of [clone coordinates v])) / (distance)) ))\nelse\n    set [direction v] to ((0) - ([asin v] of (((Clone x) - (item ((1) + ((2) * ((-1) + (index)))) of [clone coordinates v])) / (distance)) ))\nend\nset [direction v] to ((((direction) + (180)) mod (360)) - (180))\n\ndefine store clone coordinates in list at index: (index)\nrepeat until <<not <not (item ((1) + ((2) * ((-1) + (index)))) of [clone coordinates v])>> and (item ((2) + ((2) * ((-1) + (index)))) of [clone coordinates v])>\n    add [1] to [clone coordinates v]\n    add [1] to [clone coordinates v]\nend\nreplace item ((1) + ((2) * ((-1) + (index)))) of [clone coordinates v] with (Clone x)\nreplace item ((2) + ((2) * ((-1) + (index)))) of [clone coordinates v] with (Clone y)\n\ndefine Character | x: (x) y: (y) slope: (slope) index: (index)\nif <[1] = (Clone Character Segment ID)> then\n    set [brightness v] effect to (-4)\n    if <[1] = (item ((18) + (index)) of [character segment positions v])> then\n        if <[] = (Clone Character Weapon)> then\n            switch costume to (join (Clone Character Prefix) [ Arm R])\n        else\n            switch costume to (join (join (Clone Character Prefix) [ Arm R ]) (Clone Character Weapon))\n        end\n        Apply Rotation Matrix [5] ((35) + (item ((13) + (index)) of [character segment positions v])) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\n        point in direction (((90) + (item ((9) + (index)) of [character segment positions v])) + (item ((14) + (index)) of [character segment positions v]))\n    else\n        switch costume to (join (Clone Character Prefix) [ Arm L])\n        Apply Rotation Matrix [-5] ((35) + (item ((13) + (index)) of [character segment positions v])) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\n        point in direction (((90) + (item ((10) + (index)) of [character segment positions v])) + (item ((14) + (index)) of [character segment positions v]))\n    end\n    if <<<[PC] = (Clone Character Prefix)> and <[0] = (Swinging?)>> and <key (space v) pressed?>> then\n        point towards (mouse-pointer v)\n        turn left (90) degrees\n        if <<mouse down?> and <<[1] = ((Bullet Cycle) mod (2))> and <[0] < (Bullet Cycle)>>> then\n            change [bullet cycle v] by (-0.5)\n            set [clone type v] to [Bullet]\n            create clone of (_myself_ v)\n            if <[0] = (Lag Reduction)> then\n                Clone Smoke [10]\n            end\n            set [clone type v] to [Character Segment]\n        end\n        if <not <mouse down?>> then\n            set [bullet cycle v] to ([floor v] of (Bullet Cycle) )\n        end\n    end\nend\nif <[2] = (Clone Character Segment ID)> then\n    if <[1] = (item ((18) + (index)) of [character segment positions v])> then\n        switch costume to (join (Clone Character Prefix) [ Thigh R])\n        Apply Rotation Matrix [5] (item ((13) + (index)) of [character segment positions v]) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\n    else\n        switch costume to (join (Clone Character Prefix) [ Thigh L])\n        Apply Rotation Matrix [-5] (item ((13) + (index)) of [character segment positions v]) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\n    end\n    set [brightness v] effect to (-4)\n    point in direction (((90) + (item ((3) + (index)) of [character segment positions v])) + (item ((14) + (index)) of [character segment positions v]))\nend\nif <[3] = (Clone Character Segment ID)> then\n    if <[1] = (item ((18) + (index)) of [character segment positions v])> then\n        switch costume to (join (Clone Character Prefix) [ Calf R])\n    else\n        switch costume to (join (Clone Character Prefix) [ Calf L])\n    end\n    set [brightness v] effect to (-4)\n    point in direction (((-90) + (item ((4) + (index)) of [character segment positions v])) + (item ((14) + (index)) of [character segment positions v]))\n    Apply Rotation Matrix (item ((1) + (index)) of [character segment positions v]) (item ((2) + (index)) of [character segment positions v]) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\nend\nif <[4] = (Clone Character Segment ID)> then\n    set [brightness v] effect to (-4)\n    if <[1] = (item ((18) + (index)) of [character segment positions v])> then\n        switch costume to (join (Clone Character Prefix) [ Foot R])\n    else\n        switch costume to (join (Clone Character Prefix) [ Foot L])\n    end\n    point in direction ((item ((11) + (index)) of [character segment positions v]) + (item ((14) + (index)) of [character segment positions v]))\n    Apply Rotation Matrix (item ((1) + (index)) of [character segment positions v]) (item ((2) + (index)) of [character segment positions v]) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\nend\nif <[5] = (Clone Character Segment ID)> then\n    if <[1] = (item ((18) + (index)) of [character segment positions v])> then\n        switch costume to (join (Clone Character Prefix) [ Torso R])\n    else\n        switch costume to (join (Clone Character Prefix) [ Torso L])\n    end\n    point in direction ((90) + (item ((14) + (index)) of [character segment positions v]))\n    Apply Rotation Matrix [0] ((15) + (item ((13) + (index)) of [character segment positions v])) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\nend\nif <[6] = (Clone Character Segment ID)> then\n    if <[1] = (item ((18) + (index)) of [character segment positions v])> then\n        switch costume to (join (Clone Character Prefix) [ Head R])\n    else\n        switch costume to (join (Clone Character Prefix) [ Head L])\n    end\n    point in direction ((90) + (item ((14) + (index)) of [character segment positions v]))\n    Apply Rotation Matrix [0] ((28) + ((-0.15) * (([abs v] of (Clone x velocity) ) * ([sin v] of ((Clone x) * ((360) / (stride length))) )))) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\nend\nif <[7] = (Clone Character Segment ID)> then\n    point in direction (((90) + (item ((7) + (index)) of [character segment positions v])) + (item ((14) + (index)) of [character segment positions v]))\n    if <[1] = (item ((18) + (index)) of [character segment positions v])> then\n        switch costume to (join (Clone Character Prefix) [ Thigh R])\n        Apply Rotation Matrix [-5] (item ((13) + (index)) of [character segment positions v]) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\n    else\n        switch costume to (join (Clone Character Prefix) [ Thigh L])\n        Apply Rotation Matrix [5] (item ((13) + (index)) of [character segment positions v]) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\n    end\nend\nif <[8] = (Clone Character Segment ID)> then\n    if <[1] = (item ((18) + (index)) of [character segment positions v])> then\n        switch costume to (join (Clone Character Prefix) [ Calf R])\n    else\n        switch costume to (join (Clone Character Prefix) [ Calf L])\n    end\n    point in direction (((-90) + (item ((8) + (index)) of [character segment positions v])) + (item ((14) + (index)) of [character segment positions v]))\n    Apply Rotation Matrix (item ((5) + (index)) of [character segment positions v]) (item ((6) + (index)) of [character segment positions v]) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\nend\nif <[9] = (Clone Character Segment ID)> then\n    if <[1] = (item ((18) + (index)) of [character segment positions v])> then\n        switch costume to (join (Clone Character Prefix) [ Foot R])\n    else\n        switch costume to (join (Clone Character Prefix) [ Foot L])\n    end\n    point in direction ((item ((12) + (index)) of [character segment positions v]) + (item ((14) + (index)) of [character segment positions v]))\n    Apply Rotation Matrix (item ((5) + (index)) of [character segment positions v]) (item ((6) + (index)) of [character segment positions v]) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\nend\nif <[10] = (Clone Character Segment ID)> then\n    if <[1] = (item ((18) + (index)) of [character segment positions v])> then\n        switch costume to (join (Clone Character Prefix) [ Arm R])\n        Apply Rotation Matrix [-9] ((35) + (item ((13) + (index)) of [character segment positions v])) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\n        point in direction (((90) + (item ((10) + (index)) of [character segment positions v])) + (item ((14) + (index)) of [character segment positions v]))\n    else\n        if <[] = (Clone Character Weapon)> then\n            switch costume to (join (Clone Character Prefix) [ Arm L])\n        else\n            switch costume to (join (join (Clone Character Prefix) [ Arm L ]) (Clone Character Weapon))\n        end\n        Apply Rotation Matrix [9] ((35) + (item ((13) + (index)) of [character segment positions v])) for trig functions (item ((15) + (index)) of [character segment positions v]) (item ((16) + (index)) of [character segment positions v])\n        point in direction (((90) + (item ((9) + (index)) of [character segment positions v])) + (item ((14) + (index)) of [character segment positions v]))\n    end\n    if <<<[PC] = (Clone Character Prefix)> and <[0] = (Swinging?)>> and <key (space v) pressed?>> then\n        point towards (mouse-pointer v)\n        turn left (90) degrees\n        if <<mouse down?> and <<[0] = ((Bullet Cycle) mod (2))> and <[0] < (Bullet Cycle)>>> then\n            change [bullet cycle v] by (-0.5)\n            set [clone type v] to [Bullet]\n            create clone of (_myself_ v)\n            if <[0] = (Lag Reduction)> then\n                Clone Smoke [10]\n            end\n            set [clone type v] to [Character Segment]\n        end\n        if <not <mouse down?>> then\n            set [bullet cycle v] to ([floor v] of (Bullet Cycle) )\n        end\n    end\nend\nset [clone x v] to ((x) + (output x))\nset [clone y v] to ((y) + (output y))\n\ndefine Add Character | x: (x) y: (y) costume prefix: (costume prefix) weapon: (weapon)\nswitch costume to (character hitbox v)\nset [clone x v] to (x)\nset [clone y v] to (y)\nset [clone size v] to [1]\nset [clone character index v] to (length of [character segment positions v])\nset [clone character prefix v] to (costume prefix)\nset [clone character weapon v] to (weapon)\nset [clone type v] to [-Character Manager]\ncreate clone of (_myself_ v)\nset [clone type v] to [Character Segment]\nset [clone character segment id v] to [0]\nrepeat (10)\n    change [clone character segment id v] by (1)\n    create clone of (_myself_ v)\nend\nrepeat (22)\n    add [0] to [character segment positions v]\nend\nreplace item ((20) + (Clone Character index)) of [character segment positions v] with (Clone x)\nreplace item ((21) + (Clone Character index)) of [character segment positions v] with (Clone y)\nreplace item ((22) + (Clone Character index)) of [character segment positions v] with [100]\nset [clone type v] to [Not a Clone]\n\ndefine Set Leg Angles | thigh length: (thigh) calf length: (calf) hip y: (hipy) slope: (slope) index: (index) jumping? <jumping?> wall jumping? <wall jumping?> xvel / max xvel (xvel/maxvel) right/left (1/-1) (right/left) swing state (swing state) swing direction (swing direction) attack type (attack type) attack counter (attack counter)\nreplace item ((18) + (index)) of [character segment positions v] with (right/left)\nreplace item ((19) + (index)) of [character segment positions v] with (xvel/maxvel)\nreplace item ((13) + (index)) of [character segment positions v] with (hipy)\nif <wall jumping?> then\n    replace item ((17) + (index)) of [character segment positions v] with ((25) * ((1) + ((-2) * <[0] > (xvel/maxvel)>)))\nend\nif <<not <[0] = (swing state)>> or <[5] < ([abs v] of (swing direction) )>> then\n    replace item ((14) + (index)) of [character segment positions v] with (swing direction)\n    replace item ((15) + (index)) of [character segment positions v] with ([sin v] of (swing direction) )\n    replace item ((16) + (index)) of [character segment positions v] with ([cos v] of (swing direction) )\n    replace item ((17) + (index)) of [character segment positions v] with [0]\nend\nif <<[0] = (swing state)> and <not <[0] = (item ((17) + (index)) of [character segment positions v])>>> then\n    replace item ((14) + (index)) of [character segment positions v] with ((item ((14) + (index)) of [character segment positions v]) + (item ((17) + (index)) of [character segment positions v]))\n    replace item ((15) + (index)) of [character segment positions v] with ([sin v] of ((90) + (item ((14) + (index)) of [character segment positions v])) )\n    replace item ((16) + (index)) of [character segment positions v] with ([cos v] of ((90) + (item ((14) + (index)) of [character segment positions v])) )\n    if <[180] < ([abs v] of (item ((14) + (index)) of [character segment positions v]) )> then\n        replace item ((17) + (index)) of [character segment positions v] with [0]\n        replace item ((14) + (index)) of [character segment positions v] with ((-180) + (((180) + (item ((14) + (index)) of [character segment positions v])) mod (360)))\n    end\nelse\n    if <[4] > ([abs v] of (item ((14) + (index)) of [character segment positions v]) )> then\n        replace item ((14) + (index)) of [character segment positions v] with [0]\n        replace item ((15) + (index)) of [character segment positions v] with [1]\n        replace item ((16) + (index)) of [character segment positions v] with [0]\n    else\n        replace item ((14) + (index)) of [character segment positions v] with ((0.8) * (item ((14) + (index)) of [character segment positions v]))\n        replace item ((15) + (index)) of [character segment positions v] with ([sin v] of ((90) + (item ((14) + (index)) of [character segment positions v])) )\n        replace item ((16) + (index)) of [character segment positions v] with ([cos v] of ((90) + (item ((14) + (index)) of [character segment positions v])) )\n    end\nend\nif <jumping?> then\n    if <[1] = (right/left)> then\n        replace item ((1) + (index)) of [character segment positions v] with (((0.5) * (item ((1) + (index)) of [character segment positions v])) + ((0.5) * ((5) + ((((0) - (xvel/maxvel)) * ((0.5) * (Clone y velocity))) + ((1.5) * ((15) - ([abs v] of ((0.5) * (Clone y velocity)) )))))))\n        replace item ((5) + (index)) of [character segment positions v] with (((0.5) * (item ((5) + (index)) of [character segment positions v])) + ((0.5) * ((-5) + ((((0) - (xvel/maxvel)) * ((0.5) * (Clone y velocity))) + ((-1.5) * ((15) - ([abs v] of ((0.5) * (Clone y velocity)) )))))))\n    else\n        replace item ((1) + (index)) of [character segment positions v] with (((0.5) * (item ((1) + (index)) of [character segment positions v])) + ((0.5) * ((-5) + ((((0) - (xvel/maxvel)) * ((0.5) * (Clone y velocity))) + ((-1.5) * ((15) - ([abs v] of ((0.5) * (Clone y velocity)) )))))))\n        replace item ((5) + (index)) of [character segment positions v] with (((0.5) * (item ((5) + (index)) of [character segment positions v])) + ((0.5) * ((5) + ((((0) - (xvel/maxvel)) * ((0.5) * (Clone y velocity))) + ((1.5) * ((15) - ([abs v] of ((0.5) * (Clone y velocity)) )))))))\n    end\n    replace item ((2) + (index)) of [character segment positions v] with (((0.5) * (item ((2) + (index)) of [character segment positions v])) + ((0.5) * ((-95) + ((2.5) * ((15) - ([abs v] of ((0.5) * (Clone y velocity)) ))))))\n    replace item ((6) + (index)) of [character segment positions v] with (((0.5) * (item ((6) + (index)) of [character segment positions v])) + ((0.5) * ((-95) + ((2.5) * ((15) - ([abs v] of ((0.5) * (Clone y velocity)) ))))))\n    if <[0] = (swing state)> then\n        replace item ((10) + (index)) of [character segment positions v] with (((0.8) * (item ((10) + (index)) of [character segment positions v])) + ((0.2) * (80)))\n        if <[0] = (attack counter)> then\n            replace item ((9) + (index)) of [character segment positions v] with (((0.8) * (item ((9) + (index)) of [character segment positions v])) + ((0.2) * (-80)))\n        else\n            if <[1] = (attack type)> then\n                if <[20] > (attack counter)> then\n                    replace item ((9) + (index)) of [character segment positions v] with (((0.8) * (item ((9) + (index)) of [character segment positions v])) + ((0.2) * ((-180) * (right/left))))\n                else\n                    replace item ((9) + (index)) of [character segment positions v] with (((0.5) * (item ((9) + (index)) of [character segment positions v])) + ((0.5) * ((0) * (right/left))))\n                end\n            end\n        end\n    else\n        replace item ((9) + (index)) of [character segment positions v] with (((0.7) * (item ((9) + (index)) of [character segment positions v])) + ((0.3) * (-180)))\n        replace item ((10) + (index)) of [character segment positions v] with (((0.7) * (item ((10) + (index)) of [character segment positions v])) + ((0.3) * (180)))\n    end\nelse\n    set [angle a v] to ((90) - ([atan v] of (slope) ))\n    replace item ((10) + (index)) of [character segment positions v] with (((0.5) * (item ((10) + (index)) of [character segment positions v])) + ((0.5) * ((-6) * (([abs v] of ((5) * (xvel/maxvel)) ) * ([cos v] of ((Clone x) * ((180) / (stride length))) )))))\n    if <[0] = (attack counter)> then\n        replace item ((9) + (index)) of [character segment positions v] with (((0.5) * (item ((9) + (index)) of [character segment positions v])) + ((0.5) * ((6) * (([abs v] of ((5) * (xvel/maxvel)) ) * ([cos v] of ((Clone x) * ((180) / (stride length))) )))))\n    else\n        if <[1] = (attack type)> then\n            if <[20] > (attack counter)> then\n                replace item ((9) + (index)) of [character segment positions v] with (((0.8) * (item ((9) + (index)) of [character segment positions v])) + ((0.2) * ((-180) * (right/left))))\n            else\n                replace item ((9) + (index)) of [character segment positions v] with (((0.5) * (item ((9) + (index)) of [character segment positions v])) + ((0.5) * ((0) * (right/left))))\n            end\n        end\n    end\n    if <[1] = (right/left)> then\n        replace item ((1) + (index)) of [character segment positions v] with ((5) + (([abs v] of (xvel/maxvel) ) * (([abs v] of (((Clone x) mod ((2) * (stride length))) - (stride length)) ) - ((0.5) * (stride length)))))\n    else\n        replace item ((1) + (index)) of [character segment positions v] with ((-5) + (([abs v] of (xvel/maxvel) ) * (([abs v] of (((Clone x) mod ((2) * (stride length))) - (stride length)) ) - ((0.5) * (stride length)))))\n    end\n    if <(stride length) < ((Clone x) mod ((2) * (stride length)))> then\n        replace item ((2) + (index)) of [character segment positions v] with ((-80) + (((slope) * (item ((1) + (index)) of [character segment positions v])) + ((-2) * (([abs v] of ((5) * (xvel/maxvel)) ) * ([sin v] of ((Clone x) * ((180) / (stride length))) )))))\n        replace item ((11) + (index)) of [character segment positions v] with ((angle a) + ((4) * (([abs v] of ((5) * (xvel/maxvel)) ) * ([sin v] of (((Clone x) + (stride length)) * ((360) / (stride length))) ))))\n    else\n        replace item ((2) + (index)) of [character segment positions v] with ((-80) + ((slope) * (item ((1) + (index)) of [character segment positions v])))\n        replace item ((11) + (index)) of [character segment positions v] with (angle a)\n    end\n    if <[1] = (right/left)> then\n        replace item ((5) + (index)) of [character segment positions v] with ((-5) + (([abs v] of (xvel/maxvel) ) * (([abs v] of ((((Clone x) + (stride length)) mod ((2) * (stride length))) - (stride length)) ) - ((0.5) * (stride length)))))\n    else\n        replace item ((5) + (index)) of [character segment positions v] with ((5) + (([abs v] of (xvel/maxvel) ) * (([abs v] of ((((Clone x) + (stride length)) mod ((2) * (stride length))) - (stride length)) ) - ((0.5) * (stride length)))))\n    end\n    if <(stride length) < (((Clone x) + (stride length)) mod ((2) * (stride length)))> then\n        replace item ((6) + (index)) of [character segment positions v] with ((-80) + (((slope) * (item ((5) + (index)) of [character segment positions v])) + ((2) * (([abs v] of ((5) * (xvel/maxvel)) ) * ([sin v] of ((Clone x) * ((180) / (stride length))) )))))\n        replace item ((12) + (index)) of [character segment positions v] with ((angle a) + ((4) * (([abs v] of ((5) * (xvel/maxvel)) ) * ([sin v] of (((Clone x) + (stride length)) * ((360) / (stride length))) ))))\n    else\n        replace item ((6) + (index)) of [character segment positions v] with ((-80) + ((slope) * (item ((5) + (index)) of [character segment positions v])))\n        replace item ((12) + (index)) of [character segment positions v] with (angle a)\n    end\nend\nif <[1] = (right/left)> then\n    set [distance v] to ([sqrt v] of ((((5) - (item ((1) + (index)) of [character segment positions v])) * ((5) - (item ((1) + (index)) of [character segment positions v]))) + (((hipy) - (item ((2) + (index)) of [character segment positions v])) * ((hipy) - (item ((2) + (index)) of [character segment positions v])))) )\n    set [angle c v] to ([asin v] of (((5) - (item ((1) + (index)) of [character segment positions v])) / (distance)) )\nelse\n    set [distance v] to ([sqrt v] of ((((-5) - (item ((1) + (index)) of [character segment positions v])) * ((-5) - (item ((1) + (index)) of [character segment positions v]))) + (((hipy) - (item ((2) + (index)) of [character segment positions v])) * ((hipy) - (item ((2) + (index)) of [character segment positions v])))) )\n    set [angle c v] to ([asin v] of (((-5) - (item ((1) + (index)) of [character segment positions v])) / (distance)) )\nend\nif <<([abs v] of (xvel/maxvel) ) < [0.5]> and <not <jumping?>>> then\n    if <(distance) > ((thigh) + (calf))> then\n        if <[1] = (right/left)> then\n            Straight Leg Off Ground | index hipx hipy direction legLength (index) [5] (hipy) (angle c) ((thigh) + (calf))\n        else\n            Straight Leg Off Ground | index hipx hipy direction legLength (index) [-5] (hipy) (angle c) ((thigh) + (calf))\n        end\n    else\n        replace item ((3) + (index)) of [character segment positions v] with (angle c)\n        replace item ((4) + (index)) of [character segment positions v] with (angle c)\n    end\n    if <[1] = (right/left)> then\n        set [distance v] to ([sqrt v] of ((((-5) - (item ((5) + (index)) of [character segment positions v])) * ((-5) - (item ((5) + (index)) of [character segment positions v]))) + (((hipy) - (item ((6) + (index)) of [character segment positions v])) * ((hipy) - (item ((6) + (index)) of [character segment positions v])))) )\n        set [angle c v] to ([asin v] of (((-5) - (item ((5) + (index)) of [character segment positions v])) / (distance)) )\n    else\n        set [distance v] to ([sqrt v] of ((((5) - (item ((5) + (index)) of [character segment positions v])) * ((5) - (item ((5) + (index)) of [character segment positions v]))) + (((hipy) - (item ((6) + (index)) of [character segment positions v])) * ((hipy) - (item ((6) + (index)) of [character segment positions v])))) )\n        set [angle c v] to ([asin v] of (((5) - (item ((5) + (index)) of [character segment positions v])) / (distance)) )\n    end\n    if <(distance) > ((thigh) + (calf))> then\n        if <[1] = (right/left)> then\n            Straight Leg Off Ground | index hipx hipy direction legLength ((4) + (index)) [-5] (hipy) (angle c) ((thigh) + (calf))\n        else\n            Straight Leg Off Ground | index hipx hipy direction legLength ((4) + (index)) [5] (hipy) (angle c) ((thigh) + (calf))\n        end\n    else\n        replace item ((7) + (index)) of [character segment positions v] with (angle c)\n        replace item ((8) + (index)) of [character segment positions v] with (angle c)\n    end\nelse\n    if <(distance) > ((thigh) + (calf))> then\n        if <[1] = (right/left)> then\n            Straight Leg Off Ground | index hipx hipy direction legLength (index) [5] (hipy) (angle c) ((thigh) + (calf))\n        else\n            Straight Leg Off Ground | index hipx hipy direction legLength (index) [-5] (hipy) (angle c) ((thigh) + (calf))\n        end\n    else\n        Get Angles for Tri with Sides abc (calf) (thigh) (distance)\n        if <[1] = (right/left)> then\n            replace item ((3) + (index)) of [character segment positions v] with ((angle c) - (angle a))\n            replace item ((4) + (index)) of [character segment positions v] with ((angle c) + (angle b))\n        else\n            replace item ((3) + (index)) of [character segment positions v] with ((angle c) + (angle a))\n            replace item ((4) + (index)) of [character segment positions v] with ((angle c) - (angle b))\n        end\n    end\n    if <[1] = (right/left)> then\n        set [distance v] to ([sqrt v] of ((((-5) - (item ((5) + (index)) of [character segment positions v])) * ((-5) - (item ((5) + (index)) of [character segment positions v]))) + (((hipy) - (item ((6) + (index)) of [character segment positions v])) * ((hipy) - (item ((6) + (index)) of [character segment positions v])))) )\n        set [angle c v] to ([asin v] of (((-5) - (item ((5) + (index)) of [character segment positions v])) / (distance)) )\n    else\n        set [distance v] to ([sqrt v] of ((((5) - (item ((5) + (index)) of [character segment positions v])) * ((5) - (item ((5) + (index)) of [character segment positions v]))) + (((hipy) - (item ((6) + (index)) of [character segment positions v])) * ((hipy) - (item ((6) + (index)) of [character segment positions v])))) )\n        set [angle c v] to ([asin v] of (((5) - (item ((5) + (index)) of [character segment positions v])) / (distance)) )\n    end\n    if <(distance) > ((thigh) + (calf))> then\n        if <[1] = (right/left)> then\n            Straight Leg Off Ground | index hipx hipy direction legLength ((4) + (index)) [-5] (hipy) (angle c) ((thigh) + (calf))\n        else\n            Straight Leg Off Ground | index hipx hipy direction legLength ((4) + (index)) [5] (hipy) (angle c) ((thigh) + (calf))\n        end\n    else\n        Get Angles for Tri with Sides abc (calf) (thigh) (distance)\n        if <[1] = (right/left)> then\n            replace item ((7) + (index)) of [character segment positions v] with ((angle c) - (angle a))\n            replace item ((8) + (index)) of [character segment positions v] with ((angle c) + (angle b))\n        else\n            replace item ((7) + (index)) of [character segment positions v] with ((angle c) + (angle a))\n            replace item ((8) + (index)) of [character segment positions v] with ((angle c) - (angle b))\n        end\n    end\nend\nif <jumping?> then\n    replace item ((11) + (index)) of [character segment positions v] with (((0.8) * (item ((11) + (index)) of [character segment positions v])) + ((0.2) * ((90) + (item ((4) + (index)) of [character segment positions v]))))\n    replace item ((12) + (index)) of [character segment positions v] with (((0.8) * (item ((12) + (index)) of [character segment positions v])) + ((0.2) * ((90) + (item ((8) + (index)) of [character segment positions v]))))\nend\nset [wall jump v] to [0]\n\ndefine Apply Rotation Matrix (x) (y) for trig functions (sine) (cosine)\nif <[1] = (sine)> then\n    set [output x v] to (x)\n    set [output y v] to (y)\nelse\n    set [output x v] to (((x) * (sine)) - (((20) + (y)) * (cosine)))\n    set [output y v] to ((-20) + (((x) * (cosine)) + (((20) + (y)) * (sine))))\nend\n\ndefine Get Angles for Tri with Sides abc (a) (b) (c)\nset [angle a v] to ([acos v] of (((((b) * (b)) + ((c) * (c))) - ((a) * (a))) / ((2) * ((b) * (c)))) )\nset [angle b v] to ([acos v] of (((((c) * (c)) + ((a) * (a))) - ((b) * (b))) / ((2) * ((c) * (a)))) )\n\ndefine Swing Bar\nif <[0] = (swing state)> then\n    set [swing direction v] to ((swing direction) * (0.8))\n    Check for Swing Bar\nend\nif <<not <[0] = (swing state)>> or <((65) * (65)) > (distance)>> then\n    if <[0] = (swing state)> then\n        set [distance v] to ([sqrt v] of (distance) )\n        if <[0] < ((Clone y) - (item ((2) + (i)) of [swing bars v]))> then\n            set [swing direction v] to ((180) + ([asin v] of (((Clone x) - (item ((1) + (i)) of [swing bars v])) / (distance)) ))\n        else\n            set [swing direction v] to ((0) - ([asin v] of (((Clone x) - (item ((1) + (i)) of [swing bars v])) / (distance)) ))\n        end\n        set [swing direction v] to ((((swing direction) + (180)) mod (360)) - (180))\n        set [clone x v] to (((-65) * ([sin v] of (swing direction) )) + (item ((1) + (i)) of [swing bars v]))\n        set [clone y v] to (((-65) * ([cos v] of (swing direction) )) + (item ((2) + (i)) of [swing bars v]))\n        if <[0] > (Clone x velocity)> then\n            set [swing state v] to [-1]\n        else\n            set [swing state v] to [1]\n        end\n    end\n    if <[-1] = (swing state)> then\n        change [swing direction v] by (12)\n    else\n        change [swing direction v] by (-12)\n    end\n    set [clone x v] to (((-65) * ([sin v] of (swing direction) )) + (item ((1) + (i)) of [swing bars v]))\n    set [clone y v] to (((-65) * ([cos v] of (swing direction) )) + (item ((2) + (i)) of [swing bars v]))\n    if <[-1] = (swing state)> then\n        if <[60] < ((((swing direction) + (180)) mod (360)) - (180))> then\n            set [clone x velocity v] to [-15]\n            set [clone y velocity v] to [20]\n            set [swing state v] to [0]\n        end\n    else\n        if <[-60] > ((((swing direction) + (180)) mod (360)) - (180))> then\n            set [clone x velocity v] to [15]\n            set [clone y velocity v] to [20]\n            set [swing state v] to [0]\n        end\n    end\nend\n\ndefine Check for Swing Bar\nset [distance v] to ((65) * (65))\nset [i v] to [0]\nrepeat ((length of [swing bars v]) / (2))\n    set [distance v] to ((((Clone x) - (item ((1) + (i)) of [swing bars v])) * ((Clone x) - (item ((1) + (i)) of [swing bars v]))) + (((Clone y) - (item ((2) + (i)) of [swing bars v])) * ((Clone y) - (item ((2) + (i)) of [swing bars v]))))\n    if <((65) * (65)) > (distance)> then\n        stop [this script v]\n    end\n    change [i v] by (2)\nend\n\ndefine Straight Leg Off Ground | index hipx hipy direction legLength (index) (hipx) (hipy) (direction) (leglength)\nreplace item ((3) + (index)) of [character segment positions v] with (direction)\nreplace item ((4) + (index)) of [character segment positions v] with (direction)\nreplace item ((1) + (index)) of [character segment positions v] with ((hipx) + (([sin v] of ((180) + (direction)) ) * (leglength)))\nreplace item ((2) + (index)) of [character segment positions v] with ((hipy) + (([cos v] of ((180) + (direction)) ) * (leglength)))\n\ndefine Level (size) (offsetx) (ofsetty)\nswitch costume to (dock v)\nAdd Clone | x: (((-0.25) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 1 v)\nAdd Clone | x: (offsetx) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 2 v)\nAdd Clone | x: (((1) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 3 v)\nAdd Clone | x: (((2) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 4 v)\nAdd Clone | x: (((3) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 5 v)\nAdd Clone | x: (((4) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 6 v)\nAdd Clone | x: (((4) * ((480) * ((size) / (100)))) + (offsetx)) y: (((1) * ((360) * ((size) / (100)))) + (ofsetty)) size: (size) type: []\nswitch costume to (level part 7 v)\nAdd Clone | x: (((3) * ((480) * ((size) / (100)))) + (offsetx)) y: (((1) * ((360) * ((size) / (100)))) + (ofsetty)) size: (size) type: []\n\ndefine Parallax (size) (offsetx) (offsety)\nswitch costume to (parallax part 2 v)\nAdd Parallax Layer | x: (((1) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) depth (between 0 and 1): [1] size: (size)\nswitch costume to (parallax part 3 v)\nAdd Parallax Layer | x: (((2) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) depth (between 0 and 1): [1] size: (size)\nswitch costume to (parallax part 4 v)\nAdd Parallax Layer | x: (((3) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) depth (between 0 and 1): [1] size: (size)\nswitch costume to (parallax part 5 v)\nAdd Parallax Layer | x: (((4) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) depth (between 0 and 1): [1] size: (size)\nswitch costume to (parallax part 6 v)\nAdd Parallax Layer | x: (((4) * ((480) * ((size) / (100)))) + (offsetx)) y: (((1) * ((360) * ((size) / (100)))) + (ofsetty)) depth (between 0 and 1): [1] size: (size)\nswitch costume to (parallax part 7 v)\nAdd Parallax Layer | x: (((3) * ((480) * ((size) / (100)))) + (offsetx)) y: (((1) * ((360) * ((size) / (100)))) + (ofsetty)) depth (between 0 and 1): [1] size: (size)\n\ndefine NPC AI Package | left/right jump wall_jump friendly? (left/right) <jump> <wall_jump> (friendly?)\nif <<[1] = (Destroy All Enemies?)> and <not <[1] = (friendly?)>>> then\n    replace item ((22) + (Clone Character index)) of [character segment positions v] with [0]\n    start sound (join (join (Clone Character Prefix) [ Death ]) (pick random (1) to (2)))\n    change [clone count v] by (-1)\n    delete this clone\nend\nif <not <[0] < (item ((22) + (Clone Character index)) of [character segment positions v])>> then\n    start sound (join (join (Clone Character Prefix) [ Death ]) (pick random (1) to (2)))\n    if <[SW] = (Clone Character Prefix)> then\n        wait ((Respawn Time) + (pick random (-2) to (2))) seconds\n        replace item ((22) + (Clone Character index)) of [character segment positions v] with [100]\n        wait (0.5) seconds\n    else\n        change [clone count v] by (-1)\n        delete this clone\n    end\nend\nif <<[220] > ([abs v] of (((Clone x) - (Hitbox x)) * (Hitbox size)) )> and <[160] > ([abs v] of (((Clone y) - (Hitbox y)) * (Hitbox size)) )>> then\n    if <[0] = (swing state)> then\n        Player Physics | acceleration [3.5] friction (between 0 and 1) [0.7] jump height [30] gravity [-3] key inputs (right, left, up) <[0] > ((left/right) * (pick random (0) to (10)))> <[0] < ((left/right) * (pick random (0) to (10)))> <jump> player? (true/false) [false] wall jump <wall_jump>\n        if <[true] = (x colision?)> then\n            change [x collision counter v] by [1]\n        else\n            set [x collision counter v] to [0]\n        end\n        if <[1] = (friendly?)> then\n            if <<[0.05] > ([abs v] of (Clone x velocity) )> and <not <[0] = (<[0] < (Clone x velocity)> - <(Clone x) < (Player x)>)>>> then\n                set [clone x velocity v] to ((0.05) * ((-1) + ((2) * <(Clone x) < (Player x)>)))\n            end\n        else\n            if <<<[120] > ([abs v] of ((Clone x) - (Player x)) )> and <[0] = (Attack Counter)>> and <<[41] > ((Clone y) - (Player y))> and <[-84] < ((Clone y) - (Player y))>>> then\n                set [attack counter v] to [1]\n                if <[0.05] > ([abs v] of (Clone x velocity) )> then\n                    set [clone x velocity v] to ((0.05) * ((-1) + ((2) * <(Clone x) < (Player x)>)))\n                end\n            end\n            if <[0] < (Attack Counter)> then\n                if <[0.05] > ([abs v] of (Clone x velocity) )> then\n                    set [clone x velocity v] to ((0.05) * ((-1) + ((2) * <[0] < (Clone x velocity)>)))\n                end\n                change [attack counter v] by [1]\n            end\n            if <[25] = (Attack Counter)> then\n                if <<[40] > ([abs v] of (((Clone x) + ((30) * ((-1) + ((2) * <[0] < (Clone x velocity)>)))) - (Player x)) )> and <<[41] > ((Clone y) - (Player y))> and <[-84] < ((Clone y) - (Player y))>>> then\n                    replace item (22) of [character segment positions v] with ((-20) + (item (22) of [character segment positions v]))\n                    start sound (join [Punch ] (pick random (1) to (3)))\n                else\n                    start sound (join [Miss ] (pick random (1) to (3)))\n                end\n            end\n            if <[30] < (Attack Counter)> then\n                set [attack counter v] to [0]\n            end\n        end\n    else\n        set [attack counter v] to [0]\n        if <not <[0] = (suspend x controls)>> then\n            change [suspend x controls v] by (-1)\n            if <[0] > (suspend x controls)> then\n                set [suspend x controls v] to [0]\n            end\n        end\n    end\n    if <[1] < (timer)> then\n        Swing Bar\n    end\n    Set Leg Angles | thigh length: [25] calf length: [25] hip y: ((-35) + ((-0.3) * (([abs v] of (Clone x velocity) ) * ([cos v] of ((Clone x) * ((360) / (stride length))) )))) slope: (slope) index: (Clone Character index) jumping? <[0] = (y colision?)> wall jumping? <[1] = (wall jump)> xvel / max xvel ((Clone x velocity) / (10)) right/left (1/-1) ((-1) + ((2) * <[0] < (Clone x velocity)>)) swing state (swing state) swing direction (swing direction) attack type (Attack Type) attack counter (Attack Counter)\n    replace item ((20) + (Clone Character index)) of [character segment positions v] with (Clone x)\n    replace item ((21) + (Clone Character index)) of [character segment positions v] with (Clone y)\nend\n\ndefine Add Parallax Horizon | y: (y) depth (0-1): (depth coefficient)\nset [clone y v] to (y)\nset [clone paralax depth v] to (depth coefficient)\nset [clone type v] to [Parallax Horizon]\nset [clone costume v] to (costume [name v])\ncreate clone of (_myself_ v)\nset [clone type v] to [Not a Clone]\n\ndefine Check for Character at x: (x) y: (y) ignore index: (i)\nset [i v] to [0]\nrepeat ((length of [character segment positions v]) / (22))\n    if <<not <(i) = (i)>> and <[0] < (item ((22) + (i)) of [character segment positions v])>> then\n        if <[20] > ([abs v] of ((x) - (item ((20) + (i)) of [character segment positions v])) )> then\n            if <<[41] > ((y) - (item ((21) + (i)) of [character segment positions v]))> and <[-84] < ((y) - (item ((21) + (i)) of [character segment positions v]))>> then\n                stop [this script v]\n            end\n        end\n    end\n    change [i v] by (22)\nend\nset [i v] to [-1]\n\ndefine Object Physics | gravity (gravity) collision coefficient (-1 to 1, negative for bounce) (collision coefficient) ground friction (ground friction)\nset rotation style [don't rotate v]\nCheck for Ground Collision at x: ((Clone x) + (Clone x velocity)) y: (Clone y) size: (Clone size)\nif <[true] = (Ground?)> then\n    if <(Clone y velocity) < [0]> then\n        Slope Detection | iterations: ([ceiling v] of (([abs v] of (Clone x velocity) ) / ((4) * (Hitbox size))) ) iteration height: [1]\n    end\n    if <[true] = (Ground?)> then\n        set [clone x velocity v] to ((Clone x velocity) * (collision coefficient))\n    else\n        set [distance v] to ([sqrt v] of (((slope height) * (slope height)) + ((Clone x velocity) * (Clone x velocity))) )\n        if <(Clone x velocity) > [0]> then\n            change [clone x v] by (((Clone x velocity) * (Clone x velocity)) / (distance))\n            change [clone y v] by ((slope height) * (((Clone x velocity) / (distance)) - (1)))\n        else\n            change [clone x v] by ((0) - (((Clone x velocity) * (Clone x velocity)) / (distance)))\n            change [clone y v] by ((slope height) * ((((0) - (Clone x velocity)) / (distance)) - (1)))\n        end\n    end\n    set [clone x velocity v] to ((Clone x velocity) * (ground friction))\nelse\n    change [clone x v] by (Clone x velocity)\nend\nset [x colision? v] to (Ground?)\nchange [clone y velocity v] by (gravity)\nset [clone y velocity v] to ((Clone y velocity) * (0.98))\nCheck for Ground Collision at x: (Clone x) y: ((Clone y) + (Clone y velocity)) size: (Clone size)\nset [y colision? v] to (Ground?)\nif <[true] = (Ground?)> then\n    if <(Clone y velocity) < [-3.5]> then\n        Slope Detection | iterations: (round ([abs v] of (((10) * (Clone y velocity)) / (Hitbox size)) )) iteration height: [0.1]\n    end\n    set [clone y velocity v] to ((Clone y velocity) * (collision coefficient))\nelse\n    change [clone y v] by (Clone y velocity)\nend\nset rotation style [all around v]\n\ndefine Clone Smoke (n)\nhide\nset [clone type v] to [Smoke Particle]\nrepeat (n)\n    create clone of (_myself_ v)\nend\n\ndefine Set Enemy Wake-Up X and Respawn Time (x) (time)\nset [clone base x v] to (x)\nset [respawn time v] to (time)\n\ndefine Add Talisman | x y health (x) (y) (health)\nset [clone type v] to [Talisman]\nset [clone x v] to (x)\nset [clone y v] to (y)\nset [clone size v] to [1]\nset [clone character index v] to (length of [character segment positions v])\ncreate clone of (_myself_ v)\nrepeat (22)\n    add [0] to [character segment positions v]\nend\nreplace item ((20) + (Clone Character index)) of [character segment positions v] with (Clone x)\nreplace item ((21) + (Clone Character index)) of [character segment positions v] with (Clone y)\nreplace item ((22) + (Clone Character index)) of [character segment positions v] with (health)\nset [clone type v] to [Not a Clone]\n\nwhen I receive [dead v]\nstop [other scripts in sprite v]\nif <not <<<[-] = (letter (1) of (Clone type))> or <[Not a Clone] = (Clone type)>> or <<[Bullet] = (Clone type)> or <[Smoke Particle] = (Clone type)>>>> then\n    set [gray? v] to [1]\n    create clone of (_myself_ v)\n    set [color v] effect to (100)\n    set [ghost v] effect to (100)\n    repeat (50)\n        change [ghost v] effect by (-1)\n    end\n    if <[Character Segment] = (Clone type)> then\n        Character | x: (item ((20) + (Clone Character index)) of [character segment positions v]) y: (item ((21) + (Clone Character index)) of [character segment positions v]) slope: [] index: (Clone Character index)\n    end\nelse\n    if <[-Character Manager] = (Clone type)> then\n        if <[0] = (Clone x velocity)> then\n            set [clone x velocity v] to [-0.01]\n            set [clone y velocity v] to [-3]\n            Set Leg Angles | thigh length: [25] calf length: [25] hip y: ((-35) + ((-0.3) * (([abs v] of (Clone x velocity) ) * ([cos v] of ((Clone x) * ((360) / (stride length))) )))) slope: (slope) index: (Clone Character index) jumping?  wall jumping? <[1] = (wall jump)> xvel / max xvel ((Clone x velocity) / (10)) right/left (1/-1) ((-1) + ((2) * <[0] < (Clone x velocity)>)) swing state (swing state) swing direction (swing direction) attack type (Attack Type) attack counter (Attack Counter)\n        end\n    end\nend\n\nwhen I receive [initialize v]\nif  then\n    delete this clone\nend\n\ndefine Add Wall Torch | x: (x) y: (y) activation x: (bx)\nset [clone base x v] to (bx)\nswitch costume to (torch light v)\nAdd Clone | x: (x) y: (y) size: [100] type: [Torch Light]\nswitch costume to (torch v)\nAdd Clone | x: (x) y: (y) size: [100] type: [Torch]\n\n@Ground Hitbox\n\ndefine Level (size) (offsetx) (ofsetty)\nswitch costume to (dock v)\nAdd Clone | x: (((-0.25) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 1 v)\nAdd Clone | x: (offsetx) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 2 v)\nAdd Clone | x: (((1) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 3 v)\nAdd Clone | x: (((2) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 4 v)\nAdd Clone | x: (((3) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 5 v)\nAdd Clone | x: (((4) * ((480) * ((size) / (100)))) + (offsetx)) y: (ofsetty) size: (size) type: []\nswitch costume to (level part 6 v)\nAdd Clone | x: (((4) * ((480) * ((size) / (100)))) + (offsetx)) y: (((1) * ((360) * ((size) / (100)))) + (ofsetty)) size: (size) type: []\nswitch costume to (level part 7 v)\nAdd Clone | x: (((3) * ((480) * ((size) / (100)))) + (offsetx)) y: (((1) * ((360) * ((size) / (100)))) + (ofsetty)) size: (size) type: []\n\nwhen I receive [clone v]\nset [ghost v] effect to (100)\nshow\nClone Ground Hitbox\nhide\nset [ghost v] effect to (0)\n\ndefine Clone Ground Hitbox\nswitch costume to (player ship 1 v)\nAdd Clone | x: [-1000] y: [-180] size: [300] type: []\nLevel [400] [0] [0]\n\ndefine Add Clone | x: (x) y: (y) size: (size) type: (type)\nset [clone x v] to (x)\nset [clone y v] to (y)\nset [clone size v] to (size)\nplace at x y size (x) (y) (size) x offset: (Hitbox x) y offset: (Hitbox y) size coefficient: (Hitbox size)\nchange [clone count v] by (1)\ncreate clone of (_myself_ v)\n\ndefine place at x y size (x) (y) (size) x offset: (x offset) y offset: (y offset:) size coefficient: (size coefficient)\nset size to ((size) * (size coefficient)) %\ngo to x: (((x) - (x offset)) * (size coefficient)) y: (((y) - (y offset:)) * (size coefficient))\n\nwhen I receive [realign hitbox v]\nset [hitbox x v] to (New Hitbox x)\nset [hitbox y v] to (New Hitbox y)\nset [hitbox size v] to (New Hitbox size)\nplace at x y size (Clone x) (Clone y) (Clone size) x offset: (Hitbox x) y offset: (Hitbox y) size coefficient: (Hitbox size)\n\nset [hitbox size v] to [0.25]\n\nwhen I receive [initialize v]\nif  then\n    delete this clone\nend\n\n@Dialogue Engine\n\ndefine Print Text | Text: (text) size: (size) x: (x) y: (y) line end x: (endl x)\nif <<[\] = (letter (1) of (text))> and <[s] = (letter (2) of (text))>> then\n    set [i v] to [3]\n    set [clone size v] to (size)\n    set [clone x v] to (x)\n    set [clone y v] to (y)\n    repeat until <(i) > (length of (text))>\n        if <[\] = (letter (i) of (text))> then\n            change [i v] by (1)\n            if <[n] = (letter (i) of (text))> then\n                set [clone x v] to (x)\n                change [clone y v] by ((-24) * ((size) / (100)))\n            end\n        else\n            switch costume to (letter (i) of (text))\n            if <not <[ ] = (letter (i) of (text))>> then\n                create clone of (_myself_ v)\n            end\n            change [clone x v] by (((size) / (100)) * ((-3) + (item (costume [number v]) of [character widths v])))\n        end\n        change [i v] by (1)\n    end\n    switch costume to (  v)\nelse\n    set [i v] to [1]\n    set [edited text v] to [\s]\n    set [line length v] to [0]\n    repeat until <(i) > (length of (text))>\n        set [word v] to []\n        set [word length v] to [0]\n        repeat until <<[whitespace characters v] contains (letter (i) of (text))?> or <(i) > (length of (text))>>\n            switch costume to (  v)\n            switch costume to (letter (i) of (text))\n            set [word v] to (join (word) (costume [name v]))\n            change [word length v] by (((size) / (100)) * ((-3) + (item (costume [number v]) of [character widths v])))\n            change [i v] by (1)\n        end\n        if <((endl x) - (x)) < ((line length) + (word length))> then\n            set [edited text v] to (join (edited text) [\n])\n            set [line length v] to [0]\n        else\n            change [line length v] by (((size) / (100)) * ((-3) + (item (1) of [character widths v])))\n        end\n        set [edited text v] to (join (join (edited text) (word)) (letter (i) of (text)))\n        change [line length v] by (word length)\n        if <[\] = (letter (i) of (text))> then\n            change [i v] by (1)\n            if <[n] = (letter (i) of (text))> then\n                set [edited text v] to (join (edited text) [n])\n                set [line length v] to [0]\n            end\n        end\n        change [i v] by (1)\n    end\n    Print Text | Text: (edited text) size: (size) x: (x) y: (y) line end x: (endl x)\nend\n\nwhen I start as a clone\nchange [clone count v] by (1)\ngo to [front v] layer\nset size to (Clone size) %\ngo to x: (Clone x) y: (Clone y)\nshow\n\nwhen I receive [delete text v]\nchange [clone count v] by (-1)\nif  then\n    delete this clone\nend\nchange [clone count v] by (1)\n\nwhen I receive [dialogue v]\nset [line index v] to [0]\nset [dialogue mode? v] to [1]\nshow\nrepeat ((length of [text v]) / (3))\n    Print Text | Text: (item ((1) + (Line Index)) of [text v]) size: [150] x: [-210] y: [-69] line end x: [220]\n    Print Text | Text: (item ((2) + (Line Index)) of [text v]) size: [100] x: [-220] y: [-105] line end x: [220]\n    wait until <not <key (z v) pressed?>>\n    wait until <key (z v) pressed?>\n    change [line index v] by (3)\n    broadcast (Delete Text v)\nend\nset [dialogue mode? v] to [0]\nhide\n\nwhen I receive [initialize v]\nif  then\n    delete this clone\nend\nhide\n\n@Goals and Dialog Notice\n\nwhen I receive [frame v]\nif <[0] = (Dead?)> then\n    if <<[0] = (i)> and <<[0] = (Dialogue Mode?)> and <[0] = (item (1) of [goal progress v])>>> then\n        replace item (1) of [goal progress v] with [1]\n        set [goal v] to [1]\n        set [i v] to (1)\n    end\n    if <<[0] = (i)> and <<[7550] < (Player x)> and <[0] = (item (2) of [goal progress v])>>> then\n        replace item (1) of [goal progress v] with [2]\n        replace item (2) of [goal progress v] with [1]\n        set [goal v] to [2]\n        set [i v] to (1)\n    end\n    if <<[0] = (i)> and <<[1] = (Destroy All Enemies?)> and <[0] = (item (3) of [goal progress v])>>> then\n        replace item (2) of [goal progress v] with [2]\n        replace item (3) of [goal progress v] with [1]\n        set [goal v] to [3]\n        set [i v] to (1)\n    end\n    if <<[0] = (i)> and <<[-730] > (Player x)> and <[1] = (item (3) of [goal progress v])>>> then\n        set [goal v] to [0]\n        replace item (3) of [goal progress v] with [2]\n        broadcast (End v)\n    end\n    if <[0] < (i)> then\n        change [i v] by (1)\n        switch costume to (join [Goal ] (Goal))\n        go to x: (0) y: ((y position) * (0.8))\n        if <[120] < (i)> then\n            set [i v] to (0)\n        end\n    else\n        go to x: (0) y: ((((y position) - (150)) * (0.8)) + (150))\n    end\nelse\n    if <<[102] > ([abs v] of (mouse x) )> and <<[-35] > (mouse y)> and <[-95] < (mouse y)>>> then\n        switch costume to (dead highlighted v)\n    else\n        switch costume to (dead v)\n    end\nend\n\nwhen [z v] key pressed\nif <<(Positioned?) = [True]> and <[0] = (Dialogue Mode?)>> then\n    broadcast (Dialogue v)\nend\n\ndefine Check Positioning\nset [counter v] to [0]\nset [positioned? v] to [False]\nrepeat ((length of [talk positions v]) / (4))\n    change [counter v] by (4)\n    if <(item (Counter) of [talk positions v]) > (Player y)> then\n        if <(Player y) > (item ((Counter) - (1)) of [talk positions v])> then\n            if <(item ((Counter) - (2)) of [talk positions v]) > (Player x)> then\n                if <(Player x) > (item ((Counter) - (3)) of [talk positions v])> then\n                    set [positioned? v] to [True]\n                    stop [this script v]\n                end\n            end\n        end\n    end\nend\n\nCheck Positioning\nif <<(Positioned?) = [True]> and <[0] = (Dialogue Mode?)>> then\n    go to x: (0) y: ((y position) * (0.8))\nelse\n    go to x: (0) y: ((((y position) - (50)) * (0.8)) + (50))\nend\n\nwhen I receive [dead v]\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nwait (1) seconds\nrepeat (40)\n    change [ghost v] effect by (-2)\nend\nforever\n    if <<mouse down?> and <[Dead Highlighted] = (costume [name v])>> then\n        wait until <not <<mouse down?> and <[Dead Highlighted] = (costume [name v])>>>\n        if <not <mouse down?>> then\n            broadcast (Start v)\n            stop [this script v]\n        end\n    end\nend\n\nwhen I receive [initialize v]\nset [i v] to [0]\nset [goal v] to [0]\ndelete all of [goal progress v]\nadd [0] to [goal progress v]\nadd [0] to [goal progress v]\nadd [0] to [goal progress v]\ngo to x: (0) y: (150)\nswitch costume to (goal 1 v)\nclear graphic effects\n\n@Bullet Indicator\n\nwhen I receive [frame v]\nswitch costume to (join [I] ([floor v] of (Bullet Cycle) ))\nif <<[0] = ([floor v] of (Bullet Cycle) )> and <[0] = (Reload)>> then\n    broadcast (Reload v)\nend\n\nwhen I receive [reload v]\nset [reload v] to [1]\nset [bullet cycle v] to [0]\nwait (1.5) seconds\nset [reload v] to [0]\nset [bullet cycle v] to [6]\nstart sound [Cock Back v]\n\nwhen [r v] key pressed\nif <<not <[6] = (Bullet Cycle)>> and <[0] = (Reload)>> then\n    broadcast (Reload v) and wait\nend\n\nwhen I receive [dead v]\nrepeat (50)\n    change [ghost v] effect by (2)\nend\n\nwhen I receive [initialize v]\nset [bullet cycle v] to [6]\nset [reload v] to [0]\nclear graphic effects\n\n@Health Bar\n\nwhen I receive [frame v]\nif <[1] = (Clone type)> then\n    if <[0] < (Player Health)> then\n        switch costume to (join [Health Bar ] (([floor v] of ((Player Health) / (10)) ) - (1)))\n    else\n        switch costume to (health bar 0 v)\n    end\nelse\n    if <[0] < (Player Health)> then\n        switch costume to (health 2 v)\n        set x to ((-185) + ((1.5) * ((0.56) * ((Player Health) - (100)))))\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [clone v]\ngo to x: (-185) y: (155)\nshow\nset [clone type v] to [1]\ncreate clone of (_myself_ v)\nset [clone type v] to [0]\n\nwhen I receive [dead v]\nrepeat (50)\n    change [ghost v] effect by (2)\nend\n\nwhen I start as a clone\nchange [clone count v] by (1)\n\nwhen I receive [initialize v]\nif  then\n    delete this clone\nend\nclear graphic effects\n\n@Thumbnail/End\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nswitch costume to (thumbnail v)\n\ndefine Clone (n) at (x) (y)\ngo to x: (x) y: (y)\nset [i v] to [0]\nset [i2 v] to [0]\nrepeat (length of (n))\n    change [i v] by (1)\n    switch costume to (join [E] (letter (i) of (n)))\n    create clone of (_myself_ v)\n    if <[.] = (letter (i) of (n))> then\n        change x by (4)\n        set [i2 v] to [1]\n    else\n        change x by (12)\n    end\n    if <[2] < (i2)> then\n        stop [this script v]\n    end\n    if <[0] < (i2)> then\n        change [i2 v] by [1]\n    end\nend\n\nwhen I receive [end v]\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nswitch costume to (thumbnail v)\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nbroadcast (Initialize v) and wait\nwait (1) seconds\nswitch costume to (end v)\ncreate clone of (_myself_ v)\nClone ([floor v] of ((Level Timer) / ((30) * (60))) ) at [-200] [80]\nchange x by (4)\nswitch costume to (mins v)\ncreate clone of (_myself_ v)\nClone ((([floor v] of ((Level Timer) / (0.3)) ) / (100)) mod (60)) at [-200] [55]\nchange x by (4)\nswitch costume to (secs v)\ncreate clone of (_myself_ v)\ngo to x: (0) y: (0)\nswitch costume to (thumbnail v)\nrepeat (20)\n    change [ghost v] effect by (5)\nend\n\n