Teamwork||A Platformer #Games

Instructions:                      ▁▂▃▅▆▇Instructions▆▅▅▃▂▁\n#10 Trending on 15.2.2021\nThank You Soo Much!!!\n\nUse Key Up To Jump   -  ▲\nUse Key Right To go Right   -  ▶\nUse Key Left To go Left  -  ◀\n\nSong : Mystic Forest by HeatleyBros\n\nInfo About Contest ▼\n\nBy - @SUNBITES10\n\n-Rules: \n.Must be a remix\n.If not 100% made by you, you have to give credits\n.Ends 2/15/2021, Winners announced 2/16/2021\n.It can be ANY TYPE of platformer\n.Don't backpack, cheaters don't win\n\n-Prizes:\n.1st place: 25 Follows, hearts and favs\n.2nd place: 20 Follows, hearts and favs\n.3rd place: 15 Follows, hearts and favs\n.4th place: 10 Follows, hearts and favs\n.5th place: 5 Follows, hearts and favs\nAll participants receive 1 follow.\n\n-I will increase the prizes if more ppl join, and if i like more than 3 project.

@Stage\n\nwhen I receive [change state v]\nswitch backdrop to (title v)\n\nwhen flag clicked\nswitch backdrop to (title v)\nset [timer v] to [0]\nforever\n    if <<(game state - current) = [game]> and <(text?) = [0]>> then\n        change [timer v] by (1)\n        wait (1) seconds\n    end\nend\n\nwhen [timer v] > (1000)\nreset timer\n\nwhen I receive [start level - back layer v]\nswitch backdrop to (sky-day v)\n\nwhen I receive [credits v]\nswitch backdrop to (sky-dusk v)\n\n@player\n\nwhen flag clicked\nhide\nset size to (100) %\nset [const - friction v] to [0.5]\nset [const - jump power v] to [12]\nset [const - climb speed v] to [3]\nset [const - wall jump? v] to [0]\nset [const - gravity v] to [-1]\nset [animation frame v] to [0]\nset [slope v] to [0]\nset rotation style [left-right v]\nset [const - max speed v] to [8]\nset [time midair v] to [0]\nset [global level v] to [1]\nset [player spawn x v] to [-150]\nset [player spawn y v] to [-50]\nset [disqualified? v] to [0]\nset [score - total v] to [0]\nset [levels cleared v] to [0]\nsetup\n\ndefine animate costume\nif <not <(player move dir) = [0]>> then\n    point in direction (player move dir)\nend\nif <(player move mode) = [p]> then\n    set [animation frame v] to (((animation frame) + (0.5)) mod (5))\n    switch costume to ([floor v] of (((animation frame) mod (4)) + (16)) )\nelse\n    if <<<(player move mode) = [w]> and <(time midair) < [2]>> and <not <(player move dir) = [0]>>> then\n        set [animation frame v] to (((animation frame) + (0.5)) mod (5))\n        switch costume to ([floor v] of (((animation frame) mod (5)) + (2)) )\n    else\n        if <(player move mode) = [c]> then\n            point in direction (1)\n            if <((player move dir) + ((CTRLS - up) - (CTRLS - down))) > [0]> then\n                set [animation frame v] to (((animation frame) + ((0.4) * <(([abs v] of (player xvel) ) + ([abs v] of (player yvel) )) > [0]>)) mod (4))\n            end\n            switch costume to (([floor v] of (animation frame) ) + (12))\n        else\n            if <(player move mode) = [h]> then\n                switch costume to (hurt v)\n            else\n                if <(player move mode) = [v]> then\n                    switch costume to (victory v)\n                else\n                    if <[15] < (time midair)> then\n                        set [animation frame v] to (((animation frame) + (0.5)) mod (5))\n                        switch costume to ([floor v] of (((animation frame) mod (2)) + (10)) )\n                    else\n                        if <[10] < (time midair)> then\n                            switch costume to (jump2 v)\n                        else\n                            if <[2] < (time midair)> then\n                                switch costume to (jump1 v)\n                            else\n                                set [animation frame v] to [0]\n                                switch costume to (idle v)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine None\nset [player move dir v] to (left/right)\nif <(mode) = [w]> then\n    change [player xvel v] by (player move dir)\n    if <(player move dir) = [0]> then\n        set [player xvel v] to ((player xvel) * (CONST - friction))\n    else\n        if <(CONST - max speed) < ([abs v] of (player xvel) )> then\n            change [player xvel v] by ((0) - (player move dir))\n        end\n    end\nelse\n    if <(mode) = [p]> then\n        set [player xvel v] to ((player xvel) * (CONST - friction))\n    else\n        if <(mode) = [c]> then\n            set [player xvel v] to ((CONST - climb speed) * (player move dir))\n        else\n            if <(mode) = [s]> then\n                set [player xvel v] to ((player move dir) * ((CONST - max speed) / (2)))\n            else\n                if <(mode) = [f]> then\n                    set [player xvel v] to ((CONST - max speed) * (player move dir))\n                else\n                    if <(mode) = [h]> then\n                        if <(time midair) = [0]> then\n                            set [player xvel v] to ((player xvel) * (CONST - friction))\n                        end\n                    else\n                        set [player xvel v] to [0]\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine None\nif <<(mode) = [w]> or <(mode) = [p]>> then\n    if <<(up/down) > [0]> and <(time midair) < [2]>> then\n        if <(time midair) < [1]> then\n            add [jump] to [sounds v]\n        end\n        set [player yvel v] to (CONST - jump power)\n    end\n    change [time midair v] by (1)\n    if <((-2.5) * (CONST - max speed)) < (player yvel)> then\n        change [player yvel v] by (CONST - gravity)\n    end\nelse\n    if <(mode) = [h]> then\n        change [time midair v] by (1)\n        if <((-2.5) * (CONST - max speed)) < (player yvel)> then\n            change [player yvel v] by (CONST - gravity)\n        end\n    else\n        if <(mode) = [c]> then\n            set [player yvel v] to ((CONST - climb speed) * (up/down))\n        else\n            if <(mode) = [s]> then\n                set [player yvel v] to (((CONST - jump power) / (2)) * (up/down))\n            else\n                if <(mode) = [f]> then\n                    set [player yvel v] to ((up/down) * (CONST - max speed))\n                else\n                end\n            end\n        end\n        set [time midair v] to [1]\n    end\nend\n\ndefine setup\nhide\nset [text? v] to [1]\nset [player xvel v] to [0]\nset [player yvel v] to [0]\nset [player xpos v] to (player spawn x)\nset [player ypos v] to (player spawn y)\nif <<(player spawn x) = [-150]> and <(player spawn y) = [-50]>> then\n    set [camera x v] to [0]\n    set [camera y v] to [0]\nelse\n    set [camera x v] to (player spawn x)\n    set [camera y v] to (player spawn y)\nend\nset [edit mode? v] to [0]\nset [player move mode v] to [w]\nset [player move dir v] to [0]\nset [player wall collision? v] to [0]\nset [player obj collision? v] to [0]\nset [player health v] to [4]\nset [player invincible? v] to [0]\nset [player timer v] to [0]\ngo to x: (player xpos) y: (player ypos)\npoint in direction (1)\nset [text? v] to [0]\nset [ghost v] effect to (0)\nbroadcast (HUD - health v)\nbroadcast (HUD - update score v)\n\nwhen I receive [hud - edit mode v]\nif <(edit mode?) = [0]> then\n    set [text? v] to [1]\n    hide\n    wait (0.5) seconds\n    set [text? v] to [0]\n    show\nelse\nend\n\nwhen I receive [player - hurt v]\nif <(player invincible?) = [0]> then\n    add [player hit] to [sounds v]\n    set [player invincible? v] to [1]\n    set [player move mode v] to [h]\n    set [player move dir v] to [0]\n    set [time midair v] to [1]\n    set [player xvel v] to (((0) - (CONST - max speed)) * (direction))\n    set [player yvel v] to ((CONST - jump power) / (2))\n    broadcast (HUD - health v)\n    wait until <(time midair) = [0]>\n    if <(player health) < [1]> then\n        player death\n    else\n        set [player move mode v] to [w]\n        repeat (4)\n            set [ghost v] effect to (50)\n            wait (0.2) seconds\n            set [ghost v] effect to (0)\n            wait (0.2) seconds\n        end\n        set [ghost v] effect to (0)\n        set [player invincible? v] to [0]\n    end\nend\n\ndefine player death\nset [player xvel v] to [0]\nrepeat (10)\n    add effect | ID: (2) x: (player xpos) y: ((player ypos) + (25))\nend\nset [ghost v] effect to (100)\nhide\nrepeat (30)\n    set [hud hover icon v] to [0]\n    broadcast (tick v) and wait\nend\nadd [game over] to [sounds v]\nrepeat (30)\n    set [hud hover icon v] to [0]\n    broadcast (tick v) and wait\nend\nset [text? v] to [1]\nsetup\n\ndefine None\nif <<<((text?) + (player obj collision?)) = [0]> and <(CTRLS - interact) = [1]>> and <<(player move mode) = [p]> or <(player move mode) = [w]>>> then\n    set [player move mode v] to [p]\n    if <(player timer) = [0]> then\n        set [player timer v] to (density)\n        add [punch] to [sounds v]\n        add projectile | ID: (1) x: ((player xpos) + ((direction) * (30))) y: ((player ypos) + (22))\n        add effect | ID: (1) x: ((player xpos) + ((direction) * (30))) y: ((player ypos) + (22))\n    else\n        change [player timer v] by (-1)\n    end\nelse\n    if <(player move mode) = [p]> then\n        set [player move mode v] to [w]\n    end\nend\n\ndefine None\nadd (join (join (join (join (join (id) [#]) (round (x))) [#]) (round (y))) [#]) to [active projectiles v]\n\ndefine None\nadd (join (join (join (join (join (id) [#]) (round (x))) [#]) (round (y))) [#]) to [active effects v]\n\ndefine None\nchange y by (player yvel)\nrepeat until <not <<touching (level hitbox v)?> or <touching (solid objs v)?>>>\n    if <midair> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [time midair v] to [0]\n    end\n    set [player yvel v] to [0]\nend\nchange [player ypos v] by ((y position) - (init y))\n\ndefine None\nset [slope v] to [0]\nchange x by (xvel)\nrepeat until <<(slope) > [8]> or <not <<touching (level hitbox v)?> or <touching (solid objs v)?>>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) > [8]> then\n    set [player xvel v] to [1]\n    change y by ((0) - (slope))\n    repeat until <not <<touching (level hitbox v)?> or <touching (solid objs v)?>>>\n        if <not <(xvel) = [0]>> then\n            change x by ((0) - (xvel))\n        else\n            set [player xvel v] to ((0) - ((player xvel) + ((CONST - max speed) * (([abs v] of (player xvel) ) / (player xvel)))))\n            change x by ((2) * (player xvel))\n        end\n    end\n    set [player xvel v] to [0]\nend\nchange [player xpos v] by ((x position) - (init x))\nchange [player ypos v] by ((y position) - (init y))\nscroll camera x ((480) * ((item (global level) of [level lengths v]) - (1))) (0) (0.08)\nscroll camera y (1000) (-1000) (0.3) (50)\n\nwhen I receive [reset level v]\nstop [other scripts in sprite v]\nset [score - level v] to [0]\nset [player spawn x v] to [-150]\nset [player spawn y v] to [-50]\nsetup\nmain\n\ndefine get controls\nset [ctrls - left v] to (<<key (left arrow v) pressed?> or <key (a v) pressed?>> * (-1))\nset [ctrls - right v] to <<key (right arrow v) pressed?> or <key (d v) pressed?>>\nset [ctrls - up v] to <<key (up arrow v) pressed?> or <key (w v) pressed?>>\nset [ctrls - down v] to (<<key (down arrow v) pressed?> or <key (s v) pressed?>> * (-1))\nset [ctrls - interact v] to (<key (space v) pressed?> + (0))\n\nwhen I receive [start level - front layer v]\nstop [other scripts in sprite v]\nset [player spawn x v] to [-150]\nset [player spawn y v] to [-50]\nset [score - level v] to [0]\nsetup\nset [camera x v] to [0]\nset [camera y v] to [0]\nmain\n\nwhen I receive [end level v]\nstop [other scripts in sprite v]\nhide\nset [player spawn x v] to [-150]\nset [player spawn y v] to [-50]\nsetup\n\ndefine scroll player\ngo to x: ((player xpos) - (camera x)) y: ((player ypos) - (camera y))\nif <<(round ((player xpos) - (camera x))) = (round (x position))> and <(round ((player ypos) - (camera y))) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\ndefine None\nif <not <<(player ypos) < (scroll lower bound)> or <(player ypos) > (scroll upper bound)>>> then\n    change [camera y v] by (round ((((player ypos) - (camera y)) + (camera offset)) * (drift speed)))\n    if <<(player ypos) < (scroll lower bound)> or <(player ypos) > (scroll upper bound)>> then\n        change [camera y v] by ((0) - (round ((((player ypos) - (camera y)) + (camera offset)) * (drift speed))))\n    end\nend\n\ndefine None\nif <not <<(player xpos) < (scroll lower bound)> or <(player xpos) > (scroll upper bound)>>> then\n    change [camera x v] by (round ((((player xpos) + ((player xvel) * (20))) - (camera x)) * (drift speed)))\n    if <<(camera x) < (scroll lower bound)> or <(camera x) > (scroll upper bound)>> then\n        change [camera x v] by ((0) - (round ((((player xpos) + ((player xvel) * (20))) - (camera x)) * (drift speed))))\n    end\nend\n\ndefine main\nshow\ngo to [front v] layer\ngo [backward v] (5) layers\nforever\n    switch costume to (hitbox v)\n    get controls\n    if <<(text?) = [0]> and <(edit mode?) = [0]>> then\n        player move y ((CTRLS - up) + (CTRLS - down)) (player move mode)\n        y collision | midair?: <[0] < (player yvel)> initial y: (y position)\n        player move x ((CTRLS - right) + (CTRLS - left)) (player move mode)\n        x collision | initial xvel: (round (player xvel)) initial x: (x position) initial y: (y position)\n        punch (5)\n    end\n    scroll player\n    animate costume\n    broadcast (tick v) and wait\nend\n\n@level visual\n\nwhen I receive [start level - back layer v]\nif <(level panel #) > [-1]> then\n    show\nend\n\nwhen I start as a clone\ngo to [front v] layer\ngo [backward v] (50) layers\n\nwhen I receive [tick v]\nposition\n\nwhen flag clicked\nhide\nswitch costume to (null v)\nset size to (400) %\ngo to x: (0) y: (0)\nset rotation style [don't rotate v]\nlevel lengths accessor [06,06,06,06,06,]\nset [level panel # v] to [0]\nrepeat (2)\n    switch costume to (join (global level) (join [.] (level panel #)))\n    create clone of (_myself_ v)\n    change [level panel # v] by (1)\nend\nset [level panel # v] to [-1]\nswitch costume to (null v)\n\nwhen I receive [end level v]\nstop [other scripts in sprite v]\nhide\n\ndefine position\nif <<(level panel #) > [-1]> and <(game state - current) = [game]>> then\n    set [level xpos v] to ((480) - (((camera x) + ((level panel #) * (480))) mod (960)))\n    set [level ypos v] to ((0) - (camera y))\n    go to x: (level xpos) y: (level ypos)\n    switch costume? ((([ceiling v] of (((camera x) + ((level panel #) * (480))) / (960)) ) * (2)) - (level panel #))\n    if <<(round (level xpos)) = (round (x position))> and <(round (level ypos)) = (round (y position))>> then\n        show\n    else\n        hide\n    end\nend\n\ndefine level lengths accessor []\nset [counter v] to [0]\ndelete (all) of [level lengths v]\nrepeat (round ((length of (data)) / (3)))\n    add (join (letter ((counter) + (1)) of (data)) (letter ((counter) + (2)) of (data))) to [level lengths v]\n    change [counter v] by (3)\nend\n\ndefine None\nif <not <(level costume) = (join (join (global level) [.]) (costume #))>> then\n    set [level costume v] to (join (join (global level) [.]) (costume #))\n    switch costume to (level costume)\n    if <<(costume #) > ((item (global level) of [level lengths v]) + (0))> or <(costume #) < [1]>> then\n        switch costume to (null v)\n    end\nend\n\n@level hitbox\n\nwhen flag clicked\nhide\nswitch costume to (null v)\nset size to (400) %\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nset rotation style [don't rotate v]\nset [level panel # v] to [0]\nrepeat (2)\n    switch costume to (join (global level) (join [.] (level panel #)))\n    create clone of (_myself_ v)\n    change [level panel # v] by (1)\nend\nset [level panel # v] to [-1]\nswitch costume to (null v)\n\ndefine None\nif <not <(level costume) = (join (join (global level) [.]) (costume #))>> then\n    set [level costume v] to (join (join (global level) [.]) (costume #))\n    switch costume to (level costume)\n    if <<(costume #) > ((item (global level) of [level lengths v]) + (0))> or <(costume #) < [1]>> then\n        switch costume to (null v)\n    end\nend\n\nwhen I receive [reset level v]\nif <(level panel #) > [-1]> then\n    show\n    go to [front v] layer\nend\n\nwhen I receive [end level v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [tick v]\nposition\n\nwhen I receive [start level - back layer v]\nif <(level panel #) > [-1]> then\n    show\n    go to [front v] layer\nend\n\ndefine position\nif <<(level panel #) > [-1]> and <(game state - current) = [game]>> then\n    set [level xpos v] to ((480) - (((camera x) + ((level panel #) * (480))) mod (960)))\n    set [level ypos v] to ((0) - (camera y))\n    go to x: (level xpos) y: (level ypos)\n    switch costume? ((([ceiling v] of (((camera x) + ((level panel #) * (480))) / (960)) ) * (2)) - (level panel #))\nend\n\nwhen I receive [hud - edit mode v]\nset [ghost v] effect to (((1) - (edit mode?)) * (100))\n\n@buttons\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nset rotation style [don't rotate v]\nset size to (100) %\nset [button function v] to [0]\nset [button data v] to []\n\ndefine None\nset [button timer v] to [0]\nset [button function v] to (button function)\nset [button data v] to (data)\nswitch costume to (costume)\nset [button costume v] to (costume [number v])\nif <(button data) > [0]> then\n    if <not <([floor v] of (levels cleared) ) > ((button data) - (2))>> then\n        switch costume to (locked v)\n    else\n        if <not <([floor v] of (levels cleared) ) < (button data)>> then\n            switch costume to ((button costume) + (5))\n        end\n    end\nend\nset [button x v] to (x)\nset [button y v] to (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nset [button function v] to [0]\nset [button data v] to []\n\nwhen this sprite clicked\nadd [button click] to [sounds v]\nif <(costume [number v]) = [6]> then\n    add effect | ID: (8) x: (button x) y: ((button y) + (10))\n    repeat until <<(length of [active effects v]) = [0]> and <(length of [effect clones v]) = [50]>>\n        broadcast (tick v)\n    end\nelse\n    if <(button function) = [game]> then\n        if <(game state - current) = [level select]> then\n            set [global level v] to (button data)\n            set [game state - target v] to (button function)\n            broadcast (change state v)\n        end\n    else\n        set [game state - target v] to (button function)\n        broadcast (change state v)\n    end\nend\n\nwhen I receive [change state v]\nif <(button function) = [0]> then\n    if <(game state - target) = [title]> then\n        wait until <(game state - current) = (game state - target)>\n        make button | function: [level select] costume: [start] x: (0) y: (-110) extra data: [0]\n        make button | function: [help] costume: [help] x: (-80) y: (-110) extra data: [0]\n        make button | function: [leaderboard] costume: [leader] x: (80) y: (-110) extra data: [0]\n    else\n        if <(game state - target) = [level select]> then\n            wait until <(game state - current) = (game state - target)>\n            make button | function: [game] costume: [level1] x: (-140) y: (-5) extra data: [1]\n            make button | function: [game] costume: [level2] x: (-70) y: (-5) extra data: [2]\n            make button | function: [game] costume: [level3] x: (0) y: (-5) extra data: [3]\n            make button | function: [game] costume: [level4] x: (70) y: (-5) extra data: [4]\n            make button | function: [game] costume: [level5] x: (140) y: (-5) extra data: [5]\n            make button | function: [title] costume: [back] x: (0) y: (-120) extra data: [0]\n        else\n            if <<(game state - target) = [leaderboard]> or <(game state - target) = [help]>> then\n                make button | function: [title] costume: [back] x: (0) y: (-120) extra data: [0]\n            else\n            end\n        end\n    end\nelse\n    fade and size (1)\n    delete this clone\nend\n\nwhen I start as a clone\nshow\ngo to [front v] layer\ngo [backward v] (3) layers\nbutton behavior\n\ndefine button behavior\nif <(button data) = [0]> then\n    forever\n        pop | bounciness: (0.5) min size: (100) max size: (120)\n    end\nelse\n    if <(button data) > [0]> then\n        forever\n            pop | bounciness: (0.5) min size: (100) max size: (120)\n        end\n    else\n    end\nend\n\ndefine None\nif <touching (mouse-pointer v)?> then\n    change size by (((max) - (size)) * (bounce))\nelse\n    change size by (((min) - (size)) * (bounce))\nend\n\ndefine None\nset [ghost v] effect to ((55) + ((in\(-1\)/out\(1\)) * (-45)))\nset size to ((95) + ((in\(-1\)/out\(1\)) * (5))) %\nrepeat (5)\n    change [ghost v] effect by ((in\(-1\)/out\(1\)) * (19))\n    change size by ((in\(-1\)/out\(1\)) * (-2))\nend\nhide\nset [ghost v] effect to (0)\nset size to (100) %\n\ndefine None\nadd (join (join (join (join (join (id) [#]) (round (x))) [#]) (round (y))) [#]) to [active effects v]\n\n@HUD\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nset rotation style [don't rotate v]\npoint in direction (0)\nset size to (100) %\nswitch costume to (null v)\nset [ghost v] effect to (0)\nset [hud hover icon v] to [0]\nset [hud timer v] to [0]\nset [hud clone id v] to [0]\nrepeat (3)\n    change [hud clone id v] by (1)\n    create clone of (_myself_ v)\nend\nset [hud clone id v] to [0]\n\nwhen I start as a clone\nif <(HUD clone ID) = [1]> then\n    switch costume to (edit mode v)\nelse\n    if <(HUD clone ID) = [2]> then\n        switch costume to (space1 v)\n    else\n        if <(HUD clone ID) = [3]> then\n            switch costume to (health4 v)\n        else\n        end\n    end\nend\n\nwhen I receive [end level v]\nhide\n\nwhen I receive [start level - front layer v]\nif <(HUD clone ID) = [3]> then\n    show\n    go to [front v] layer\n    go [backward v] (3) layers\nend\n\nwhen I receive [hud - edit mode v]\nif <(HUD clone ID) = [1]> then\n    if <(edit mode?) = [1]> then\n        go to x: (0) y: (0)\n        show\n        go to [front v] layer\n    else\n        hide\n    end\nend\n\nwhen I receive [hud - health v]\nif <(HUD clone ID) = [3]> then\n    switch costume to (join [health] (player health))\nend\n\nwhen I receive [tick v]\nif <(HUD clone ID) = [2]> then\n    if <(HUD hover icon) = [0]> then\n        set [player obj collision? v] to [0]\n        set [hud timer v] to [0]\n        hide\n    else\n        if <(HUD hover icon) = [space]> then\n            set [player obj collision? v] to [1]\n        end\n        go to (player v)\n        if <((HUD timer) mod (15)) = [0]> then\n            switch costume to (join (HUD hover icon) ((1) + (((HUD timer) / (15)) mod (2))))\n            show\n            go to [front v] layer\n        end\n        set [hud timer v] to (((HUD timer) + (1)) mod (30))\n        set [hud hover icon v] to [0]\n    end\nend\n\n@editor\n\nwhen flag clicked\nset [old camera x v] to [0]\nset [old camera y v] to [0]\ngo to x: (0) y: (0)\nhide\nswitch costume to (neutral v)\nshow list [objects v]\n\ndefine enter object data\nhide list [objects v]\nadd (join (join (global level) [#]) (join (join (round ((camera x) + (x position))) [#]) (join (round ((camera y) + (y position))) [#]))) to [objects v]\nask [Enter a costume ID for the object \(leave blank to skip\):] and wait\nget input (answer)\nask [If this object is animated or changes costumes, enter the number of costumes \(make sure they're in consecutive order\). Leave blank to skip:] and wait\nget input (answer)\nask [Enter an object behavior ID: \[0\] animation \[1\] dialogue \[2\] ladder \[3\] switch \[4\] door \[5\] block \[6\] moving enemy \[7\] toxic slime \[8\] event trigger \[9\] item \[10\] checkpoint \[11\] level end \[12\] beacon \[13\] abyss] and wait\nget input (answer)\nask [If this object is linked to another, enter its INDEX here \(leave blank to skip\):] and wait\nget input (answer)\nask [If this object has dialogue or health associated with it, enter it here \(leave blank to skip\):] and wait\nget input (answer)\nshow list [objects v]\nbroadcast (obj - create v)\n\ndefine None\nif <((CTRLS - right) - (CTRLS - left)) > [0]> then\n    change [camera x v] by ((speed) * ((CTRLS - right) + (CTRLS - left)))\n    if <<(camera x) < [-100]> or <(camera x) > (((480) * ((item (global level) of [level lengths v]) - (1))) + (100))>> then\n        change [camera x v] by ((0) - ((speed) * ((CTRLS - right) + (CTRLS - left))))\n    end\nend\nif <((CTRLS - up) - (CTRLS - down)) > [0]> then\n    change [camera y v] by ((speed) * ((CTRLS - up) + (CTRLS - down)))\n    if <<(camera y) < [-1000]> or <(camera y) > [1000]>> then\n        change [camera y v] by ((0) - ((speed) * ((CTRLS - up) + (CTRLS - down))))\n    end\nend\n\ndefine get input []\nif <(input) > [0]> then\n    replace item (last) of [objects v] with (join (item (last) of [objects v]) (join (input) [#]))\nelse\n    replace item (last) of [objects v] with (join (item (last) of [objects v]) (join [0] [#]))\nend\n\nwhen I receive [hud - edit mode v]\nif <(edit mode?) = [0]> then\n    set [camera x v] to (old camera x)\n    set [camera y v] to (old camera y)\n    hide\nelse\n    set [old camera x v] to (camera x)\n    set [old camera y v] to (camera y)\n    switch costume to (pointer v)\n    show\n    go to [front v] layer\n    repeat until <(edit mode?) = [0]>\n        switch costume to (pointer v)\n        go to (mouse-pointer v)\n        if <<<touching (objects v)?> or <touching (solid objs v)?>> or <touching (mobs v)?>> then\n            switch costume to (neutral v)\n            if <key (c v) pressed?> then\n                switch costume to (grab v)\n                repeat until <key (v v) pressed?>\n                    go to (mouse-pointer v)\n                    scroll (CONST - max speed)\n                end\n            end\n        end\n        scroll (CONST - max speed)\n        if <<mouse down?> and <touching (mouse-pointer v)?>> then\n            wait until <not <mouse down?>>\n            ask [Create a new object? \(yes/no\)] and wait\n            if <(answer) = [yes]> then\n                enter object data\n            end\n        end\n    end\nend\n\nwhen [r v] key pressed\nif <(backdrop [number v]) > [1]> then\n    broadcast (reset level v)\nend\n\ndefine warning\nif <<not <(username) = [amylaser]>> and <(disqualified?) = [0]>> then\n    go to x: (0) y: (-120)\n    switch costume to (null v)\n    show\n    ask [Are you sure you want to enter Edit/Cheat Mode? Doing so will disqualify your score for this session from the Leaderboard. yes/no] and wait\n    if <(answer) = [yes]> then\n        set [disqualified? v] to [1]\n    end\nend\n\nwhen [z v] key pressed\nwarning\nif <<(disqualified?) = [1]> or <(username) = [amylaser]>> then\n    ask [Enter a command \(skip / health / fly / inv\):] and wait\n    if <(answer) = [skip]> then\n        ask (join [Skip how many levels? Must be between 1 and ] (length of [level lengths v])) and wait\n        if <<[0] < ((answer) + (0))> and <((answer) + (0)) < ((length of [level lengths v]) + (1))>> then\n            set [levels cleared v] to (answer)\n            ask (join (join [Skipped ] (answer)) [ levels. Press Enter to finish]) and wait\n            set [game state - target v] to [level select]\n            broadcast (change state v)\n        else\n            ask [Invalid command. Press Enter to finish] and wait\n        end\n    else\n        if <(answer) = [fly]> then\n            if <(player move mode) = [f]> then\n                set [player move mode v] to [w]\n            else\n                set [player move mode v] to [f]\n            end\n            ask (join (join [Flying set to ] <(player move mode) = [f]>) [. Press Enter to finish]) and wait\n        else\n            if <(answer) = [health]> then\n                ask [Set health to:] and wait\n                set [player health v] to (answer)\n                broadcast (HUD - health v)\n                ask (join (join [Health was set to ] (player health)) [. Press Enter to finish]) and wait\n            else\n                if <(answer) = [inv]> then\n                    set [player invincible? v] to ((1) - (player invincible?))\n                    ask (join (join [Invincibility set to ] <(player invincible?) = [1]>) [. Press Enter to finish]) and wait\n                else\n                    if <(answer) = [win]> then\n                        ask [You win the game. Press Enter to finish.] and wait\n                        set [levels cleared v] to (length of [level lengths v])\n                        set [game state - target v] to [credits]\n                        broadcast (change state v)\n                    else\n                        ask [Invalid command. Press Enter to finish] and wait\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen [e v] key pressed\nif <(backdrop [number v]) > [1]> then\n    warning\n    if <<(disqualified?) = [1]> or <(username) = [amylaser]>> then\n        set [edit mode? v] to ((1) - (edit mode?))\n        broadcast (HUD - edit mode v)\n    end\nend\n\n@objects\n\nwhen flag clicked\nhide\nclear graphic effects\nset size to (100) %\nswitch costume to (null v)\nset rotation style [left-right v]\nset [obj index v] to [0]\nset [obj active? v] to [0]\nset [player on ladders? v] to [0]\ndelete (all) of [active switches v]\ndelete (all) of [deleted objects v]\n\ndefine scan object list\nset [obj index v] to [0]\nrepeat (length of [objects v])\n    change [obj index v] by (1)\n    try to spawn object (obj index)\nend\nset [obj index v] to [0]\n\ndefine None\nset [obj index v] to (obj index)\nset [obj data v] to (item (obj index) of [objects v])\nparse data: (obj data) divider: [#]\nif <(obj level) = (global level)> then\n    if <<(obj behavior ID) = [4]> or <(obj behavior ID) = [5]>> then\n        add (obj index) to [solid objects v]\n    else\n        if <<<(obj behavior ID) = [6]> or <(obj behavior ID) = [7]>> or <<(obj behavior ID) = [12]> or <(obj behavior ID) = [13]>>> then\n            add (obj index) to [enemies v]\n        else\n            create clone of (_myself_ v)\n            switch costume to (null v)\n        end\n    end\nend\nset [obj active? v] to [0]\n\ndefine parse data: [] divider: []\nset [function - temp1 v] to [1]\nset [function - temp2 v] to [1]\nparse data chunk | data: (data) divider: (divider)\nset [obj level v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj xpos v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj ypos v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj costume v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj # of animation frames v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj behavior id v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj linked index v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj text v] to (FUNCTION - substring)\nset [obj timer v] to [0]\nset [obj active? v] to [1]\nswitch costume to (obj costume)\n\ndefine None\nset [function - substring v] to []\nset [function - counter v] to [0]\nrepeat ((end index) - (start index))\n    set [function - substring v] to (join (FUNCTION - substring) (letter ((start index) + (FUNCTION - counter)) of (string)))\n    change [function - counter v] by (1)\nend\n\ndefine parse data chunk | data: [] divider: []\nrepeat until <(letter (FUNCTION - temp2) of (data)) = (divider)>\n    change [function - temp2 v] by (1)\nend\nsubstring | start: (FUNCTION - temp1) end: (FUNCTION - temp2) string: (data)\nset [function - temp1 v] to ((FUNCTION - temp2) + (1))\nchange [function - temp2 v] by (1)\n\ndefine None\nadd (join (join (join (join (join (id) [#]) (round (x))) [#]) (round (y))) [#]) to [active effects v]\n\nwhen I start as a clone\ngo to [front v] layer\ngo [backward v] (10) layers\n\ndefine None\nset [obj animation frame v] to (((obj animation frame) + (speed)) mod (5))\nswitch costume to ((obj costume) + (([floor v] of (obj animation frame) ) mod (obj # of animation frames)))\n\ndefine None\nif <(distance to [player v]) < [30]> then\n    set [hud hover icon v] to [space]\n    if <<(CTRLS - interact) = [1]> and <(obj timer) = [0]>> then\n        set [ctrls - interact v] to [0]\n        set [obj timer v] to [10]\n        add (obj linked index) to [active switches v]\n        add [switch] to [sounds v]\n        switch costume to ((obj costume) + ((((costume [number v]) - (obj costume)) + (1)) mod (states)))\n        add effect | ID: (1) x: (obj xpos) y: (obj ypos)\n        add effect | ID: (6) x: (obj xpos) y: (obj ypos)\n    else\n        if <(obj timer) > [0]> then\n            change [obj timer v] by (-1)\n        end\n    end\nend\n\ndefine ladder\nif <<([abs v] of ((player xpos) - (obj xpos)) ) < [20]> and <([abs v] of ((player ypos) - (obj ypos)) ) < [60]>> then\n    if <<<(CTRLS - up) = [1]> or <<(CTRLS - down) = [-1]> and <(time midair) = [1]>>> and <((CTRLS - right) - (CTRLS - left)) = [0]>> then\n        set [player move mode v] to [c]\n        set [player xpos v] to (obj xpos)\n        if <(obj timer) = [0]> then\n            set [obj timer v] to [1]\n            change [player on ladders? v] by (1)\n        end\n    else\n        if <<((CTRLS - right) - (CTRLS - left)) > [0]> or <(time midair) = [0]>> then\n            set [player move mode v] to [w]\n        end\n    end\n    if <not <(player move mode) = [c]>> then\n        set [hud hover icon v] to [climb]\n    end\nelse\n    if <(obj timer) = [1]> then\n        set [obj timer v] to [0]\n        change [player on ladders? v] by (-1)\n    end\n    if <<(player move mode) = [c]> and <(player on ladders?) = [0]>> then\n        set [player move mode v] to [w]\n    end\nend\n\ndefine None\nset [function - substring v] to (join (join (join (join (join (join (join (join (obj level) [#]) (join (round (obj xpos)) [#])) (join (round (obj ypos)) [#])) (join (obj costume) [#])) (join (obj # of animation frames) [#])) (join (obj behavior ID) [#])) (join (obj linked index) [#])) (join (obj text) [#]))\nreplace item (index) of [objects v] with (FUNCTION - substring)\n\nwhen I receive [hud - edit mode v]\nif <not <(obj index) = [0]>> then\n    if <(obj active?) = [0]> then\n        parse data: (obj data) divider: [#]\n        set [obj active? v] to [0]\n        show\n        go to [front v] layer\n        set [ghost v] effect to (50)\n    end\n    if <(obj behavior ID) = [8]> then\n        switch costume to (null v)\n    end\n    repeat until <(edit mode?) = [0]>\n        wait until <touching (mouse-pointer v)?>\n        if <(obj linked index) = [0]> then\n            say (join (join [INDEX: ] (obj index)) (join [ ACTIVE: ] (obj active?)))\n        else\n            say (join (join [INDEX: ] (obj index)) (join [ LINKED TO: ] (obj linked index)))\n        end\n        wait until <not <touching (mouse-pointer v)?>>\n        say []\n    end\n    if <(obj active?) = [0]> then\n        hide\n    end\nend\n\ndefine dialogue\nif <(distance to [player v]) < [50]> then\n    set [hud hover icon v] to [space]\n    if <<(CTRLS - interact) = [1]> and <<(obj timer) = [0]> and <(text?) = [0]>>> then\n        set [text? v] to (obj text)\n        broadcast (text - dialogue v)\n        set [player move dir v] to [0]\n        set [ctrls - interact v] to [0]\n        set [obj timer v] to [10]\n        set [player obj collision? v] to [1]\n    else\n        if <<(obj timer) > [0]> and <(text?) = [0]>> then\n            change [obj timer v] by (-1)\n        end\n    end\nend\n\ndefine None\nanimate obj | speed: (0.5)\nif <<(distance to [player v]) < [40]> and <not <(obj timer) < [0]>>> then\n    set [obj timer v] to [-100]\nend\nif <(obj timer) < [0]> then\n    change [obj timer v] by (10)\n    set [ghost v] effect to ((100) + (obj timer))\n    change [obj ypos v] by ((obj timer) / (-10))\n    if <(obj timer) = [0]> then\n        add [pickup] to [sounds v]\n        set [obj active? v] to [0]\n        change [score - level v] by (p)\n        broadcast (HUD - update score v)\n    end\nelse\n    set [obj timer v] to (((obj timer) + (5)) mod (360))\n    change [obj ypos v] by ([sin v] of (obj timer) )\nend\n\ndefine event trigger\nif <not <(costume [number v]) = (obj costume)>> then\n    switch costume to (obj costume)\nend\nif <<([abs v] of ((player xpos) - (obj xpos)) ) < [30]> and <([abs v] of ((player ypos) - (obj ypos)) ) < [100]>> then\n    set [obj active? v] to [0]\n    broadcast (obj text)\nend\n\ndefine checkpoint\nanimate obj | speed: (0.5)\nif <(distance to [player v]) < [30]> then\n    set [player spawn x v] to (obj xpos)\n    set [player spawn y v] to ((obj ypos) + (20))\n    if <(obj timer) = [0]> then\n        add [pickup] to [sounds v]\n        set [obj costume v] to ((obj costume) + (obj # of animation frames))\n        add effect | ID: (1) x: (obj xpos) y: (obj ypos)\n        add effect | ID: (7) x: (obj xpos) y: (obj ypos)\n    end\n    set [obj timer v] to [1]\nend\n\nwhen I receive [start level - back layer v]\nif <(obj index) = [0]> then\n    scan object list\n    broadcast (obj - create solid/enemy v) and wait\nelse\n    delete this clone\nend\n\ndefine level end\nif <<(distance to [player v]) < [30]> and <(obj timer) = [0]>> then\n    set [obj timer v] to [60]\n    set [player xvel v] to [0]\n    set [player move mode v] to [v]\n    add [level clear] to [sounds v]\n    repeat (10)\n        add effect | ID: (1) x: (player xpos) y: (player ypos)\n    end\nend\nif <(obj timer) > [1]> then\n    change [obj timer v] by (-1)\n    if <(obj timer) = [1]> then\n        if <not <[levels cleared v] contains (global level)?>> then\n            add (global level) to [levels cleared v]\n        end\n        set [game state - target v] to [title]\n        broadcast (change state v)\n    end\nend\n\nwhen I receive [reset level v]\nparse data: (obj data) divider: [#]\nset [ghost v] effect to (0)\n\ndefine behavior\nif <<<(edit mode?) = [0]> and <(text?) = [0]>> and <(obj active?) = [1]>> then\n    if <(obj behavior ID) = [0]> then\n        animate obj | speed: (0.5)\n    else\n        if <(obj behavior ID) = [1]> then\n            dialogue\n        else\n            if <(obj behavior ID) = [2]> then\n                ladder\n            else\n                if <(obj behavior ID) = [3]> then\n                    switch | # of states: (obj # of animation frames)\n                else\n                    if <(obj behavior ID) = [8]> then\n                        event trigger\n                    else\n                        if <(obj behavior ID) = [9]> then\n                            item | points: (10)\n                        else\n                            if <(obj behavior ID) = [10]> then\n                                checkpoint\n                            else\n                                if <(obj behavior ID) = [11]> then\n                                    level end\n                                else\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine scroll\ngo to x: ((obj xpos) - (camera x)) y: ((obj ypos) - (camera y))\nif <<(round ((obj xpos) - (camera x))) = (round (x position))> and <(round ((obj ypos) - (camera y))) = (round (y position))>> then\n    show\n    behavior\nelse\n    hide\nend\n\nwhen I receive [tick v]\nif <not <(obj index) = [0]>> then\n    if <<(obj active?) = [1]> or <<(obj active?) = [0]> and <(edit mode?) = [1]>>> then\n        scroll\n    end\nend\n\nwhen [x v] key pressed\nif <touching (mouse-pointer v)?> then\n    add (obj index) to [deleted objects v]\n    delete (obj index) of [objects v]\n    broadcast (obj - delete v) and wait\n    delete (1) of [deleted objects v]\n    delete this clone\nend\n\nwhen [c v] key pressed\nif <touching (mouse-pointer v)?> then\n    repeat until <key (v v) pressed?>\n        set [obj xpos v] to (round ((mouse x) + (camera x)))\n        set [obj ypos v] to (round ((mouse y) + (camera y)))\n    end\n    replace data | obj index: (obj index)\nend\n\nwhen I receive [obj - create v]\nif <(obj index) = [0]> then\n    try to spawn object (length of [objects v])\n    broadcast (obj - create solid/enemy v)\n    set [obj index v] to [0]\nend\n\nwhen I receive [obj - delete v]\nif <not <(obj index) = [0]>> then\n    if <(obj index) > (item (1) of [deleted objects v])> then\n        change [obj index v] by (-1)\n        replace data | obj index: (obj index)\n    end\n    if <(obj linked index) > (item (1) of [deleted objects v])> then\n        change [obj linked index v] by (-1)\n        replace data | obj index: (obj index)\n    end\nend\n\nwhen I receive [end level v]\ndelete this clone\n\n@solid objs\n\nwhen flag clicked\nhide\nclear graphic effects\nset size to (100) %\nswitch costume to (null v)\nset [obj index v] to [0]\nset [obj active? v] to [0]\nset [obj target state v] to [0]\ndelete (all) of [solid objects v]\n\ndefine scan sol.object list\nrepeat until <(length of [solid objects v]) = [0]>\n    try to spawn object (item (1) of [solid objects v])\n    delete (1) of [solid objects v]\nend\nset [obj index v] to [0]\nset [obj active? v] to [0]\n\ndefine None\nset [obj index v] to (obj index)\nset [obj data v] to (item (obj index) of [objects v])\nset [obj active? v] to [1]\nset [obj timer v] to [0]\nparse data: (obj data) divider: [#]\nif <(obj level) = (global level)> then\n    create clone of (_myself_ v)\n    switch costume to (null v)\nend\nset [obj active? v] to [0]\n\nwhen I receive [reset level v]\nset [obj active? v] to [1]\nset [obj target state v] to [0]\nparse data: (obj data) divider: [#]\nswitch costume to (obj costume)\n\nwhen I receive [end level v]\ndelete this clone\n\nwhen I receive [hud - edit mode v]\nif <not <(obj index) = [0]>> then\n    if <(obj active?) = [0]> then\n        parse data: (obj data) divider: [#]\n        set [obj active? v] to [0]\n        show\n        set [ghost v] effect to (50)\n    end\n    repeat until <(edit mode?) = [0]>\n        wait until <touching (mouse-pointer v)?>\n        if <(obj linked index) = [0]> then\n            say (join [INDEX: ] (obj index))\n        else\n            say (join (join [INDEX: ] (obj index)) (join [LINKED TO: ] (obj linked index)))\n        end\n        wait until <not <touching (mouse-pointer v)?>>\n        say []\n    end\nend\n\ndefine None\nset [obj animation frame v] to (((obj animation frame) + (speed)) mod (5))\nswitch costume to ((obj costume) + (([floor v] of (obj animation frame) ) mod (frames)))\n\ndefine None\nif <<<([abs v] of (xdist) ) < [36]> and <([abs v] of (ydist) ) < [30]>> and <<(([abs v] of (xdist) ) / (xdist)) = (player move dir)> and <(obj slope) < [8]>>> then\n    set [obj xvel v] to (((CONST - max speed) / (mass)) * (player move dir))\nelse\n    set [obj xvel v] to [0]\nend\n\nwhen I receive [tick v]\nif <<not <(obj index) = [0]>> and <(obj active?) = [1]>> then\n    scroll\n    if <(obj behavior ID) = [4]> then\n        behavior\n    end\nelse\nend\n\ndefine scroll\ngo to x: ((obj xpos) - (camera x)) y: ((obj ypos) - (camera y))\nif <<(round ((obj xpos) - (camera x))) = (round (x position))> and <(round ((obj ypos) - (camera y))) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\ngo to [front v] layer\ngo [backward v] (10) layers\n\ndefine behavior\nif <<(edit mode?) = [0]> and <(text?) = [0]>> then\n    if <(obj behavior ID) = [4]> then\n        door | # of states: (obj #of animation frames)\n    else\n        if <(obj behavior ID) = [5]> then\n            block | mass: (obj text) x dist to player: ((obj xpos) - (player xpos)) y dist to player: ((obj ypos) - (player ypos))\n        else\n        end\n    end\nend\n\ndefine dialogue\nif <<(distance to [player v]) < [50]> and <not <(obj text) = [0]>>> then\n    set [hud hover icon v] to [space]\n    if <<(CTRLS - interact) = [1]> and <<(obj timer) = [0]> and <(text?) = [0]>>> then\n        set [text? v] to (obj text)\n        broadcast (text - dialogue v)\n        set [player move dir v] to [0]\n        set [ctrls - interact v] to [0]\n        set [obj timer v] to [10]\n    else\n        if <<(obj timer) > [0]> and <(text?) = [0]>> then\n            change [obj timer v] by (-1)\n        end\n    end\nend\n\ndefine None\ndialogue\nif <(obj index) = (item (1) of [active switches v])> then\n    if <<(costume [number v]) = (obj costume)> and <(obj target state) = [0]>> then\n        set [obj target state v] to (((obj costume) + (states)) - (1))\n    else\n        if <<(costume [number v]) = (((obj costume) + (states)) - (1))> and <(obj target state) = [0]>> then\n            set [obj target state v] to (obj costume)\n        end\n    end\n    if <(costume [number v]) = (obj target state)> then\n        delete (1) of [active switches v]\n        set [obj target state v] to [0]\n    else\n        switch costume to ((costume [number v]) + (([abs v] of ((obj target state) - (costume [number v])) ) / ((obj target state) - (costume [number v]))))\n    end\nend\n\ndefine None\nadd (join (join (join (join (join (id) [#]) (round (x))) [#]) (round (y))) [#]) to [active effects v]\n\ndefine None\nset [function - substring v] to (join (join (join (join (join (join (join (join (obj level) [#]) (join (round (obj xpos)) [#])) (join (round (obj ypos)) [#])) (join (obj costume) [#])) (join (obj #of animation frames) [#])) (join (obj behavior ID) [#])) (join (obj linked index) [#])) (join (obj text) [#]))\nset [obj data v] to (FUNCTION - substring)\nreplace item (index) of [objects v] with (obj data)\n\ndefine parse data: [] divider: []\nset [function - temp1 v] to [1]\nset [function - temp2 v] to [1]\nparse data chunk | data: (data) divider: (divider)\nset [obj level v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj xpos v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj ypos v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj costume v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj #of animation frames v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj behavior id v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj linked index v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj text v] to (FUNCTION - substring)\nswitch costume to (obj costume)\n\ndefine parse data chunk | data: [] divider: []\nrepeat until <(letter (FUNCTION - temp2) of (data)) = (divider)>\n    change [function - temp2 v] by (1)\nend\nsubstring | start: (FUNCTION - temp1) end: (FUNCTION - temp2) string: (data)\nset [function - temp1 v] to ((FUNCTION - temp2) + (1))\nchange [function - temp2 v] by (1)\n\ndefine None\nset [function - substring v] to []\nset [function - counter v] to [0]\nrepeat ((end index) - (start index))\n    set [function - substring v] to (join (FUNCTION - substring) (letter ((start index) + (FUNCTION - counter)) of (string)))\n    change [function - counter v] by (1)\nend\n\nwhen [c v] key pressed\nif <touching (mouse-pointer v)?> then\n    repeat until <key (v v) pressed?>\n        set [obj xpos v] to (round ((mouse x) + (camera x)))\n        set [obj ypos v] to (round ((mouse y) + (camera y)))\n    end\n    replace data | obj index: (obj index)\nend\n\nwhen [x v] key pressed\nif <touching (mouse-pointer v)?> then\n    add (obj index) to [deleted objects v]\n    delete (obj index) of [objects v]\n    broadcast (obj - delete v) and wait\n    delete (1) of [deleted objects v]\n    delete this clone\nend\n\nwhen I receive [obj - create solid/enemy v]\nif <(obj index) = [0]> then\n    scan sol.object list\nend\n\nwhen I receive [obj - delete v]\nif <not <(obj index) = [0]>> then\n    if <(obj index) > (item (1) of [deleted objects v])> then\n        change [obj index v] by (-1)\n        replace data | obj index: (obj index)\n    end\n    if <(obj linked index) > (item (1) of [deleted objects v])> then\n        change [obj linked index v] by (-1)\n        replace data | obj index: (obj index)\n    end\nend\n\n@mobs\n\nwhen flag clicked\nhide\nclear graphic effects\nset size to (100) %\nswitch costume to (null v)\nset rotation style [left-right v]\npoint in direction (1)\nset [obj index v] to [0]\nset [obj active? v] to [0]\nset [obj target state v] to [0]\ndelete (all) of [enemies v]\n\ndefine scan enemy list\nrepeat until <(length of [enemies v]) = [0]>\n    try to spawn object (item (1) of [enemies v])\n    delete (1) of [enemies v]\nend\nset [obj index v] to [0]\nset [obj active? v] to [0]\n\ndefine None\nset [obj index v] to (obj index)\nset [obj data v] to (item (obj index) of [objects v])\nset [obj active? v] to [1]\nset [obj timer v] to [0]\nparse data: (obj data) divider: [#]\nif <(obj level) = (global level)> then\n    set [obj spawnx v] to (obj xpos)\n    set [obj spawny v] to (obj ypos)\n    create clone of (_myself_ v)\n    switch costume to (null v)\nend\nset [obj active? v] to [0]\n\ndefine None\nset [function - substring v] to []\nset [function - counter v] to [0]\nrepeat ((end index) - (start index))\n    set [function - substring v] to (join (FUNCTION - substring) (letter ((start index) + (FUNCTION - counter)) of (string)))\n    change [function - counter v] by (1)\nend\n\ndefine parse data chunk | data: [] divider: []\nrepeat until <(letter (FUNCTION - temp2) of (data)) = (divider)>\n    change [function - temp2 v] by (1)\nend\nsubstring | start: (FUNCTION - temp1) end: (FUNCTION - temp2) string: (data)\nset [function - temp1 v] to ((FUNCTION - temp2) + (1))\nchange [function - temp2 v] by (1)\n\ndefine parse data: [] divider: []\nset [function - temp1 v] to [1]\nset [function - temp2 v] to [1]\nparse data chunk | data: (data) divider: (divider)\nset [obj level v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj xpos v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj ypos v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj costume v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj #of animation frames v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj behavior id v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj linked index v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [obj text v] to (FUNCTION - substring)\nset [obj health v] to (obj text)\nset [obj xvel v] to [0]\nset [obj yvel v] to [0]\nswitch costume to (obj costume)\n\nwhen I receive [reset level v]\nset [obj active? v] to [1]\nset [obj target state v] to [0]\nparse data: (obj data) divider: [#]\nswitch costume to (obj costume)\nset size to (100) %\npoint in direction (1)\nset [ghost v] effect to (0)\n\ndefine None\nadd (join (join (join (join (join (id) [#]) (round (x))) [#]) (round (y))) [#]) to [active effects v]\n\ndefine None\nset [function - substring v] to (join (join (join (join (join (join (join (join (obj level) [#]) (join (round (obj xpos)) [#])) (join (round (obj ypos)) [#])) (join (obj costume) [#])) (join (obj #of animation frames) [#])) (join (obj behavior ID) [#])) (join (obj linked index) [#])) (join (obj text) [#]))\nset [obj data v] to (FUNCTION - substring)\nreplace item (index) of [objects v] with (obj data)\n\ndefine None\nset [obj xvel v] to ((direction) * (speed))\nif <touching (projectiles v)?> then\n    change [obj health v] by (-2)\n    set [obj xvel v] to ((0) - (obj xvel))\n    add effect | ID: (4) x: (obj xpos) y: (obj ypos)\n    set size to (120) %\nend\ngrow/shrink | target: (100)\nobj collision | init size: (size) limited range? (100) initx: (x position) inity: (y position)\nanimate obj | # of frames: (obj #of animation frames) speed: (0.2)\nif <<(distance to [player v]) < [40]> and <(player invincible?) = [0]>> then\n    change [player health v] by (-1)\n    broadcast (player - hurt v)\nend\nif <(obj health) < [0]> then\n    repeat (10)\n        add effect | ID: (2) x: (obj xpos) y: ((obj ypos) + (25))\n    end\n    change [score - level v] by (p)\n    broadcast (HUD - update score v)\n    set [obj behavior id v] to [1]\n    set [obj costume v] to ((6) + ((pick random (0) to (5)) * (2)))\n    set [obj text v] to (item (pick random (1) to (length of [npc talk v])) of [npc talk v])\n    set [obj #of animation frames v] to [2]\n    set [obj health v] to [0]\n    set size to (100) %\n    switch costume to (obj costume)\nend\nif <(obj timer) = [0]> then\n    add effect | ID: (3) x: (obj xpos) y: (obj ypos)\n    set [obj timer v] to ((((obj text) - (obj health)) + (1)) * (4))\nelse\n    change [obj timer v] by (-1)\nend\n\ndefine None\nset [obj animation frame v] to (((obj animation frame) + (speed)) mod (5))\nswitch costume to ((obj costume) + (([floor v] of (obj animation frame) ) mod (frames)))\n\ndefine dialogue\nif <(distance to [player v]) < [50]> then\n    set [hud hover icon v] to [space]\n    if <<(CTRLS - interact) = [1]> and <<(obj timer) = [0]> and <(text?) = [0]>>> then\n        set [text? v] to (obj text)\n        broadcast (text - dialogue v)\n        set [player move dir v] to [0]\n        set [ctrls - interact v] to [0]\n        set [obj timer v] to [10]\n    else\n        if <<(obj timer) > [0]> and <(text?) = [0]>> then\n            change [obj timer v] by (-1)\n        end\n    end\nend\n\ndefine None\nif <not <(round (size)) = (t)>> then\n    change size by (((t) - (size)) * (0.3))\nend\n\ndefine behavior\nif <<(edit mode?) = [0]> and <(text?) = [0]>> then\n    if <(obj behavior ID) = [1]> then\n        NPC | speed: (2)\n    else\n        if <(obj behavior ID) = [6]> then\n            enemy | speed: (2) points: (20)\n        else\n            if <(obj behavior ID) = [7]> then\n                set rotation style [don't rotate v]\n                slime | points: ((obj text) * (2))\n            else\n                if <(obj behavior ID) = [11]> then\n                    level end\n                else\n                    if <(obj behavior ID) = [12]> then\n                        beacon | points: (50)\n                    else\n                        if <(obj behavior ID) = [13]> then\n                            abyss\n                        else\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine None\nswitch costume to (hitbox v)\nset size to (100) %\nshow\nif <(obj yvel) > ((-2.5) * (CONST - max speed))> then\n    change [obj yvel v] by (CONST - gravity)\nend\nchange y by (obj yvel)\nrepeat until <not <<touching (level hitbox v)?> or <touching (solid objs v)?>>>\n    change y by (1)\n    set [obj yvel v] to [0]\nend\nset [obj slope v] to [0]\nchange x by (obj xvel)\nif <<([abs v] of (x position) ) > [235]> or <([abs v] of (y position) ) > [180]>> then\n    hide\nend\nrepeat until <<(obj slope) > [8]> or <not <<touching (level hitbox v)?> or <touching (solid objs v)?>>>>\n    change y by (1)\n    change [obj slope v] by (1)\nend\nif <<(obj slope) > [8]> or <([abs v] of ((obj xpos) - (obj spawnx)) ) > (range)>> then\n    if <(obj slope) > [8]> then\n        change y by ((0) - (obj slope))\n    end\n    set [obj xvel v] to ((0) - (obj xvel))\n    change x by ((2) * (obj xvel))\nend\nchange [obj xpos v] by ((x position) - (init x))\nchange [obj ypos v] by ((y position) - (init y))\nset size to (s) %\nif <(obj xvel) = [0]> then\n    point in direction (1)\nelse\n    point in direction (([abs v] of (obj xvel) ) / (obj xvel))\nend\n\ndefine None\nset size to (((50) + ((obj health) * (10))) + (obj animation frame)) %\nturn right (5) degrees\nchange [obj animation frame v] by (([sin v] of (direction) ) * (1))\nif <touching (projectiles v)?> then\n    change [obj health v] by (-2)\n    add effect | ID: (4) x: (obj xpos) y: (obj ypos)\nend\nif <<(distance to [player v]) < [40]> and <(player invincible?) = [0]>> then\n    change [player health v] by (-1)\n    broadcast (player - hurt v)\nend\nif <(obj health) < [0]> then\n    change [score - level v] by (p)\n    broadcast (HUD - update score v)\n    set [obj active? v] to [0]\nend\n\nwhen I receive [tick v]\nif <<not <(obj index) = [0]>> and <(obj active?) = [1]>> then\n    scroll\nelse\n    if <(edit mode?) = [0]> then\n        hide\n    end\nend\n\nwhen I receive [end level v]\ndelete this clone\n\nwhen I receive [hud - edit mode v]\nif <not <(obj index) = [0]>> then\n    if <(obj active?) = [0]> then\n        parse data: (obj data) divider: [#]\n        set [obj active? v] to [0]\n        show\n        go to [front v] layer\n        set [ghost v] effect to (50)\n    end\n    if <(obj behavior ID) = [13]> then\n        switch costume to (null v)\n    end\n    repeat until <(edit mode?) = [0]>\n        wait until <touching (mouse-pointer v)?>\n        if <(obj linked index) = [0]> then\n            say (join [INDEX: ] (obj index))\n        else\n            say (join (join [INDEX: ] (obj index)) (join [LINKED TO: ] (obj linked index)))\n        end\n        wait until <not <touching (mouse-pointer v)?>>\n        say []\n    end\nend\n\ndefine scroll\ngo to x: ((obj xpos) - (camera x)) y: ((obj ypos) - (camera y))\nif <<(round ((obj xpos) - (camera x))) = (round (x position))> and <(round ((obj ypos) - (camera y))) = (round (y position))>> then\n    show\n    behavior\nelse\n    hide\nend\n\nwhen I start as a clone\ngo to [front v] layer\ngo [backward v] (10) layers\n\ndefine level end\nanimate obj | # of frames: (obj #of animation frames) speed: (0.5)\nif <(obj timer) = [0]> then\n    set [obj timer v] to [100]\n    set [player xvel v] to [0]\n    set [player move mode v] to [v]\nend\nif <(obj timer) > [0]> then\n    change [obj timer v] by (-1)\n    if <(obj timer) = [60]> then\n        add effect | ID: (9) x: (camera x) y: (camera y)\n        broadcast (clear miasma v)\n    else\n        if <(obj timer) = [0]> then\n            if <(levels cleared) < (global level)> then\n                set [levels cleared v] to (global level)\n            end\n            if <(levels cleared) = (length of [level lengths v])> then\n                set [game state - target v] to [credits]\n            else\n                set [game state - target v] to [level select]\n            end\n            broadcast (change state v)\n        end\n    end\nend\n\nwhen I receive [obj - delete v]\nif <not <(obj index) = [0]>> then\n    if <(obj index) > (item (1) of [deleted objects v])> then\n        change [obj index v] by (-1)\n        replace data | obj index: (obj index)\n    end\n    if <(obj linked index) > (item (1) of [deleted objects v])> then\n        change [obj linked index v] by (-1)\n        replace data | obj index: (obj index)\n    end\nend\n\nwhen [c v] key pressed\nif <touching (mouse-pointer v)?> then\n    repeat until <key (v v) pressed?>\n        set [obj xpos v] to (round ((mouse x) + (camera x)))\n        set [obj ypos v] to (round ((mouse y) + (camera y)))\n    end\n    replace data | obj index: (obj index)\nend\n\nwhen [x v] key pressed\nif <touching (mouse-pointer v)?> then\n    add (obj index) to [deleted objects v]\n    delete (obj index) of [objects v]\n    broadcast (obj - delete v) and wait\n    delete (1) of [deleted objects v]\n    delete this clone\nend\n\ndefine None\ndialogue\nif <(text?) = [0]> then\n    if <(obj health) = [0]> then\n        set [obj health v] to (pick random (30) to (100))\n        set [obj xvel v] to ((pick random (-1) to (1)) * (speed))\n    else\n        change [obj health v] by (-1)\n    end\n    obj collision | init size: (100) limited range? (100) initx: (x position) inity: (y position)\n    if <([abs v] of (obj xvel) ) > [0]> then\n        animate obj | # of frames: (obj #of animation frames) speed: (0.5)\n    else\n        switch costume to (obj costume)\n    end\nend\n\ndefine abyss\nif <not <(costume [number v]) = (obj costume)>> then\n    switch costume to (obj costume)\nend\nif <<(player ypos) < (obj ypos)> and <([abs v] of ((obj xpos) - (player xpos)) ) < [75]>> then\n    set [player health v] to [0]\n    if <not <(player move mode) = [h]>> then\n        broadcast (player - hurt v)\n    end\nend\n\nwhen I receive [obj - create solid/enemy v]\nif <(obj index) = [0]> then\n    scan enemy list\nend\n\nif <(obj timer) = [0]> then\n    add effect | ID: (3) x: (obj xpos) y: (obj ypos)\n    set [obj timer v] to ((((obj text) - (obj health)) * (4)) + (1))\nelse\n    change [obj timer v] by (-1)\nend\n\ndefine None\nif <touching (projectiles v)?> then\n    change [obj health v] by (-1)\n    add effect | ID: (4) x: (obj xpos) y: (obj ypos)\nend\nif <(obj health) < [0]> then\n    repeat (10)\n        add effect | ID: (2) x: (obj xpos) y: ((obj ypos) + (25))\n    end\n    change [score - level v] by (p)\n    broadcast (HUD - update score v)\n    set [obj behavior id v] to [11]\n    set [obj costume v] to [30]\n    set [obj text v] to [0]\n    set [obj #of animation frames v] to [2]\n    set [obj health v] to [0]\n    switch costume to (obj costume)\n    repeat (10)\n        add effect | ID: (1) x: (player xpos) y: (player ypos)\n    end\nend\nswitch costume to ((obj costume) + (round (((obj text) - (obj health)) / (2))))\n\n@text: pixel\n\nwhen flag clicked\nhide\nswitch costume to (background v)\nset [ghost v] effect to (0)\nset rotation style [don't rotate v]\nfont size parser\n\ndefine None\ndelete clone\nshow\nif <(dialogue?) = [1]> then\n    go to x: ((x pos) + (184)) y: (y pos)\n    switch costume to (background v)\n    set size to (100) %\n    create clone of (_myself_ v)\nend\nswitch costume to (null v)\nset size to (size) %\nset [function - counter v] to [0]\ngo to x: (x pos) y: (y pos)\nrepeat (length of (text))\n    switch costume to (null v)\n    change [function - counter v] by (1)\n    if <(letter (FUNCTION - counter) of (text)) = [\]> then\n        if <(letter ((FUNCTION - counter) + (1)) of (text)) = [t]> then\n            wait (0.5) seconds\n            wait until <key (space v) pressed?>\n            add [talk] to [sounds v]\n            broadcast (text - clear2 dialogue v) and wait\n            go to x: (x pos) y: (y pos)\n        else\n            if <(letter ((FUNCTION - counter) + (1)) of (text)) = [n]> then\n                set x to (x pos)\n                change y by ((size) / (-4))\n            end\n        end\n        change [function - counter v] by (1)\n    else\n        switch costume to (letter (FUNCTION - counter) of (text))\n        if <<<(costume [number v]) = [95]> or <(costume [number v]) = [96]>> or <<(costume [number v]) = [1]> and <not <(letter (FUNCTION - counter) of (text)) = [1]>>>> then\n            switch costume to (join (letter (FUNCTION - counter) of (text)) [s])\n        end\n        if <<<(costume [number v]) = [1]> and <not <(letter (FUNCTION - counter) of (text)) = [1]>>> or <(costume [number v]) = [96]>> then\n            switch costume to (null v)\n        end\n        add [text blip] to [sounds v]\n        create clone of (_myself_ v)\n        change x by (((item (costume [number v]) of [font sizes v]) + (1)) * ((size) / (100)))\n        if <(x position) > (bound x)> then\n            set x to (x pos)\n            change y by ((size) / (-4))\n        end\n    end\nend\nhide\nswitch costume to (null v)\nif <(dialogue?) = [1]> then\n    wait until <key (space v) pressed?>\n    set [text? v] to [0]\n    broadcast (text - clear dialogue v)\nend\nset [text? v] to [0]\n\nwhen I receive [text - credits v]\nprint (join (join [Your final score: ] (score - total)) [\nclick anywhere to returnto title screen]) (-30) (-100) (100) (210) (0)\n\nwhen I receive [text - leaderboard v]\nprint (join (text?) (join [YOUR CURRENT SCORE: ] (score - total))) (-150) (45) (100) (200) (0)\n\nprint [by amylaser] (-184) (-125) (100) (184) (1)\n\nwhen I receive [end level v]\nhide\nstop [other scripts in sprite v]\nset [text? v] to [0]\ndelete this clone\n\nwhen I receive [text - clear2 dialogue v]\nif <(costume [number v]) = [96]> then\n    fade and size (1)\n    fade and size (-1)\nelse\n    delete this clone\nend\n\nwhen I receive [text - clear dialogue v]\nif <(costume [number v]) = [96]> then\n    stop [other scripts in sprite v]\n    fade and size (1)\nelse\n    hide\nend\ndelete this clone\n\nwhen I receive [text - dialogue v]\nadd [talk] to [sounds v]\nprint (text?) (-184) (-125) (100) (184) (1)\n\nwhen I receive [hud - edit mode v]\ndelete this clone\n\nwhen I start as a clone\ngo to [front v] layer\nif <(costume [number v]) = [96]> then\n    fade and size (-1)\nend\n\nwhen I receive [reset level v]\nhide\nstop [other scripts in sprite v]\nset [text? v] to [0]\ndelete this clone\n\nwhen I receive [start level - back layer v]\nhide\nstop [other scripts in sprite v]\nset [text? v] to [0]\ndelete this clone\n\nwhen I receive [change state v]\nhide\nstop [other scripts in sprite v]\nset [text? v] to [0]\ndelete this clone\n\ndefine None\nset [ghost v] effect to ((55) + ((in\(-1\)/out\(1\)) * (-45)))\nset size to ((95) + ((in\(-1\)/out\(1\)) * (5))) %\nrepeat (5)\n    change [ghost v] effect by ((in\(-1\)/out\(1\)) * (19))\n    change size by ((in\(-1\)/out\(1\)) * (-2))\nend\n\ndefine font size parser\nset [text? v] to [08.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.10.04.10.10.10.10.10.10.10.08.08.10.10.10.10.08.08.04.07.07.04.04.04.04.08.04.08.10.10.10.08.06.10.10.10.10.10.09.10.10.08.09.10.08.10.10.10.10.10.09.10.08.10.10.10.10.10.10.06.]\nset [function - counter v] to [0]\ndelete (all) of [font sizes v]\nrepeat ((length of (text?)) / (3))\n    change [function - counter v] by (3)\n    add (join (letter ((FUNCTION - counter) - (2)) of (text?)) (letter ((FUNCTION - counter) - (1)) of (text?))) to [font sizes v]\nend\nset [text? v] to [0]\n\ndefine delete clone\ndelete this clone\n\n@effects\n\nwhen flag clicked\nhide\nset rotation style [don't rotate v]\ngo to x: (0) y: (0)\nset [ghost v] effect to (0)\nset size to (100) %\nsetup (50)\n\ndefine None\nset [effect id v] to [0]\nset [effect health v] to [25]\nset [clone # v] to [0]\ndelete (all) of [effect clones v]\ndelete (all) of [active effects v]\nswitch costume to (heart1 v)\nrepeat (max # of clones)\n    change [clone # v] by (1)\n    add (clone #) to [effect clones v]\n    create clone of (_myself_ v)\nend\nswitch costume to (null v)\nset [clone # v] to [0]\n\nwhen I receive [end level v]\nreset effects\n\ndefine reset particle\nset [effect id v] to [0]\nset [effect health v] to [0]\nadd (clone #) to [effect clones v]\nset [ghost v] effect to (0)\nset size to (100) %\n\ndefine reset effects\nhide\nif <(clone #) = [0]> then\n    delete (all) of [active effects v]\nelse\n    if <(effect ID) > [0]> then\n        reset particle\n    end\nend\n\ndefine None\nset [function - substring v] to []\nset [function - counter v] to [0]\nrepeat ((end index) - (start index))\n    set [function - substring v] to (join (FUNCTION - substring) (letter ((start index) + (FUNCTION - counter)) of (string)))\n    change [function - counter v] by (1)\nend\n\ndefine parse data: [] divider: []\nset [function - temp1 v] to [1]\nset [function - temp2 v] to [1]\nparse data chunk | data: (data) divider: (divider)\nset [effect id v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [effect xpos v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [effect ypos v] to (FUNCTION - substring)\n\ndefine parse data chunk | data: [] divider: []\nrepeat until <(letter (FUNCTION - temp2) of (data)) = (divider)>\n    change [function - temp2 v] by (1)\nend\nsubstring | start: (FUNCTION - temp1) end: (FUNCTION - temp2) string: (data)\nchange [function - temp2 v] by (1)\nset [function - temp1 v] to (FUNCTION - temp2)\n\ndefine None\nswitch costume to (pick random (c1) to (c2))\nset size to (pick random (s1) to (s2)) %\nset [effect health v] to (h)\nset [effect xvel v] to (pick random (xv1) to (xv2))\nset [effect yvel v] to (pick random (yv1) to (yv2))\nchange [effect xpos v] by (pick random (x1) to (x2))\nchange [effect ypos v] by (pick random (y1) to (y2))\n\ndefine None\nchange [effect xpos v] by (effect xvel)\nchange [effect ypos v] by (effect yvel)\nchange [effect xvel v] by (dxv)\nchange [effect yvel v] by (dyv)\nchange size by (ds)\nif <hurts> then\n    if <<(distance to [player v]) < [20]> and <(player invincible?) = [0]>> then\n        change [player health v] by (-1)\n        broadcast (player - hurt v)\n    end\nend\n\ndefine scroll\ngo to x: (round ((effect xpos) - (camera x))) y: (round ((effect ypos) - (camera y)))\nif <<(round (x position)) = (round ((effect xpos) - (camera x)))> and <(round (y position)) = (round ((effect ypos) - (camera y)))>> then\n    show\n    go to [front v] layer\n    if <(game state - target) = [game]> then\n        go [backward v] (5) layers\n    end\nelse\n    hide\nend\n\nwhen I receive [tick v]\ntick\n\ndefine tick\nif <<<(effect ID) > [0]> and <(clone #) > [0]>> and <(text?) = [0]>> then\n    if <(effect health) > [0]> then\n        change [effect health v] by (-1)\n        scroll\n        behavior\n    else\n        fade out and reset particle\n    end\nelse\n    if <<(length of [active effects v]) > [0]> and <(clone #) = (item (1) of [effect clones v])>> then\n        set particle (item (1) of [active effects v])\n    end\nend\n\nwhen I receive [start level - back layer v]\nreset effects\n\nwhen I receive [change state v]\nreset effects\n\ndefine behavior\nif <(effect ID) = [1]> then\n    custom behavior | dsize: (-5) dxv: ((effect xvel) * (-0.1)) dyv: ((effect yvel) * (-0.1)) hurts player? \nelse\n    if <(effect ID) = [2]> then\n        custom behavior | dsize: (-2) dxv: ((effect xvel) * (-0.2)) dyv: (((effect yvel) * (-0.2)) - (0.5)) hurts player? \n    else\n        if <(effect ID) = [3]> then\n            custom behavior | dsize: (-5) dxv: ((effect xvel) * (-0.1)) dyv: ((effect yvel) * (-0.1)) hurts player? <[] = []>\n        else\n            if <(effect ID) = [5]> then\n                custom behavior | dsize: (1) dxv: ((effect xvel) * (-0.1)) dyv: ((effect yvel) * (-0.1)) hurts player? \n            else\n                if <<<<(effect ID) = [4]> or <(effect ID) = [6]>> or <(effect ID) = [7]>> or <(effect ID) = [8]>> then\n                    custom behavior | dsize: (0) dxv: (0) dyv: ((effect yvel) * (-0.1)) hurts player? \n                else\n                    if <(effect ID) = [9]> then\n                        custom behavior | dsize: (((380) - (size)) * (0.5)) dxv: (0) dyv: (0) hurts player? \n                    else\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine set particle []\ndelete (1) of [active effects v]\ndelete (1) of [effect clones v]\nparse data: (effect data) divider: [#]\nif <(effect ID) = [1]> then\n    add [explosion2] to [sounds v]\n    set custom particle | costume: (5) to (6) x: (0) to (0) y: (0) to (0) xvel: (-4) to (4) yvel: (-4) to (4) size: (100) to (130) health: (10)\nelse\n    if <(effect ID) = [2]> then\n        add [explosion1] to [sounds v]\n        set custom particle | costume: (2) to (7) x: (0) to (0) y: (0) to (0) xvel: (-10) to (10) yvel: (-10) to (10) size: (160) to (200) health: (10)\n        change [effect xvel v] by ((10) * (([abs v] of (effect xvel) ) / (effect xvel)))\n        change [effect yvel v] by ((10) * (([abs v] of (effect yvel) ) / (effect yvel)))\n    else\n        if <(effect ID) = [3]> then\n            set custom particle | costume: (8) to (11) x: (-30) to (30) y: (-30) to (30) xvel: (-2) to (2) yvel: (-2) to (0) size: (130) to (160) health: (10)\n        else\n            if <(effect ID) = [4]> then\n                add [achievement] to [sounds v]\n                set custom particle | costume: (12) to (12) x: (-30) to (30) y: (20) to (40) xvel: (0) to (0) yvel: (5) to (5) size: (100) to (100) health: (10)\n            else\n                if <(effect ID) = [5]> then\n                    set custom particle | costume: (2) to (7) x: (-30) to (30) y: (-30) to (30) xvel: (-2) to (2) yvel: (-2) to (0) size: (130) to (160) health: (10)\n                else\n                    if <(effect ID) = [6]> then\n                        set custom particle | costume: (13) to (13) x: (-30) to (30) y: (20) to (40) xvel: (0) to (0) yvel: (5) to (5) size: (100) to (100) health: (10)\n                    else\n                        if <(effect ID) = [7]> then\n                            set custom particle | costume: (14) to (14) x: (-30) to (30) y: (20) to (40) xvel: (0) to (0) yvel: (5) to (5) size: (100) to (100) health: (10)\n                        else\n                            if <(effect ID) = [8]> then\n                                set custom particle | costume: (15) to (15) x: (-30) to (30) y: (20) to (40) xvel: (0) to (0) yvel: (5) to (5) size: (100) to (100) health: (10)\n                            else\n                                if <(effect ID) = [9]> then\n                                    add [level clear] to [sounds v]\n                                    set custom particle | costume: (16) to (16) x: (0) to (0) y: (0) to (0) xvel: (0) to (0) yvel: (0) to (0) size: (0) to (0) health: (30)\n                                else\n                                    set [effect health v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [reset level v]\nreset effects\n\ndefine fade out and reset particle\nif <(effect health) > [-100]> then\n    change [effect health v] by (-10)\n    set [ghost v] effect to ([abs v] of (effect health) )\n    behavior\n    scroll\nelse\n    hide\n    reset particle\nend\n\n@projectiles\n\nwhen flag clicked\nhide\nset rotation style [all around v]\ngo to x: (0) y: (0)\nset [ghost v] effect to (0)\nset size to (100) %\nsetup (50)\n\ndefine None\nset [function - substring v] to []\nset [function - counter v] to [0]\nrepeat ((end index) - (start index))\n    set [function - substring v] to (join (FUNCTION - substring) (letter ((start index) + (FUNCTION - counter)) of (string)))\n    change [function - counter v] by (1)\nend\n\ndefine parse data: [] divider: []\nset [function - temp1 v] to [1]\nset [function - temp2 v] to [1]\nparse data chunk | data: (data) divider: (divider)\nset [projectile id v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [projectile xpos v] to (FUNCTION - substring)\nparse data chunk | data: (data) divider: (divider)\nset [projectile ypos v] to (FUNCTION - substring)\n\ndefine parse data chunk | data: [] divider: []\nrepeat until <(letter (FUNCTION - temp2) of (data)) = (divider)>\n    change [function - temp2 v] by (1)\nend\nsubstring | start: (FUNCTION - temp1) end: (FUNCTION - temp2) string: (data)\nchange [function - temp2 v] by (1)\nset [function - temp1 v] to (FUNCTION - temp2)\n\ndefine None\nset [projectile id v] to [0]\nset [projectile health v] to [25]\nset [clone # v] to [0]\ndelete (all) of [projectile clones v]\ndelete (all) of [active projectiles v]\nswitch costume to (heart1 v)\nrepeat (max # of clones)\n    change [clone # v] by (1)\n    add (clone #) to [projectile clones v]\n    create clone of (_myself_ v)\nend\nswitch costume to (null v)\nset [clone # v] to [0]\n\ndefine set projectile []\ndelete (1) of [active projectiles v]\ndelete (1) of [projectile clones v]\nparse data: (effect data) divider: [#]\nif <(projectile ID) = [1]> then\n    switch costume to (pick random (2) to (4))\n    set [projectile health v] to [25]\n    set size to (pick random (100) to (130)) %\n    set rotation style [don't rotate v]\n    set [projectile xvel v] to ((13) * ([direction v] of [player v]))\n    go to [front v] layer\nelse\nend\n\ndefine scroll\ngo to x: (round ((projectile xpos) - (camera x))) y: (round ((projectile ypos) - (camera y)))\nif <<(round (x position)) = (round ((projectile xpos) - (camera x)))> and <(round (y position)) = (round ((projectile ypos) - (camera y)))>> then\n    show\n    go to [front v] layer\nelse\n    hide\nend\n\ndefine splatter\nhide\nrepeat until <(projectile health) < [-20]>\n    add effect | ID: (1) x: (projectile xpos) y: (projectile ypos)\n    change [projectile health v] by (-10)\nend\n\ndefine reset projectile\nset [projectile id v] to [0]\nset [projectile health v] to [0]\nadd (clone #) to [projectile clones v]\nset [ghost v] effect to (0)\nset size to (100) %\n\nwhen I receive [tick v]\ntick\n\ndefine reset all projectiles\nhide\nif <(clone #) = [0]> then\n    delete (all) of [active projectiles v]\nend\nif <(projectile ID) > [0]> then\n    reset projectile\nend\n\ndefine behavior\nif <(projectile ID) = [1]> then\n    if <<<touching (level hitbox v)?> or <touching (solid objs v)?>> or <touching (mobs v)?>> then\n        set [projectile health v] to [0]\n        set [projectile xvel v] to [0]\n        set [projectile yvel v] to [0]\n    end\n    change [projectile xpos v] by (projectile xvel)\n    change [projectile ypos v] by ([sin v] of (direction) )\n    turn right (30) degrees\nelse\nend\n\nwhen I receive [end level v]\nreset all projectiles\n\nwhen I receive [start level - back layer v]\nreset all projectiles\n\ndefine tick\nif <<(projectile ID) > [0]> and <(clone #) > [0]>> then\n    if <(projectile health) > [0]> then\n        change [projectile health v] by (-1)\n        scroll\n        behavior\n    else\n        splatter\n        reset projectile\n    end\nelse\n    if <<(length of [active projectiles v]) > [0]> and <(clone #) = (item (1) of [projectile clones v])>> then\n        set projectile (item (1) of [active projectiles v])\n    end\nend\n\ndefine None\nadd (join (join (join (join (join (id) [#]) (round (x))) [#]) (round (y))) [#]) to [active effects v]\n\nwhen I receive [reset level v]\nreset all projectiles\n\n@sound\n\nwhen flag clicked\ngo to x: (215) y: (150)\nswitch costume to (unmute v)\nset volume to (100) %\nshow\ngo to [front v] layer\nset [current music v] to [Bitpop]\nforever\n    if <(current music) = []> then\n    else\n        play sound (current music) until done\n    end\nend\n\ndefine transition music | target music: []\nif <not <(current music) = (music)>> then\n    if <(costume [number v]) = [2]> then\n        set volume to (((costume [number v]) - (1)) * (100)) %\n        repeat (50)\n            change volume by (-2)\n        end\n        set [current music v] to (music)\n        stop all sounds\n        repeat (50)\n            change volume by (2)\n        end\n    else\n        set [current music v] to (music)\n    end\nend\n\nwhen I receive [start level - back layer v]\nshow\ngo to [front v] layer\ngo [backward v] (1) layers\n\nwhen I receive [change state v]\nshow\ngo to [front v] layer\nif <(game state - target) = [game]> then\n    go [backward v] (3) layers\n    transition music | target music: [Mint Breath]\nelse\n    if <(game state - target) = [title]> then\n        transition music | target music: [Bitpop]\n    else\n        if <(game state - target) = [credits]> then\n            transition music | target music: [End Credits]\n        else\n        end\n    end\nend\n\nwhen this sprite clicked\nset volume to (100) %\nstart sound [button click v]\nnext costume\nset volume to (((costume [number v]) - (1)) * (100)) %\n\nwhen flag clicked\ndelete (all) of [sounds v]\nforever\n    if <(length of [sounds v]) > [0]> then\n        start sound (item (1) of [sounds v])\n        delete (1) of [sounds v]\n    end\nend\n\n@score\n\nwhen flag clicked\nhide\nset size to (120) %\nswitch costume to (0s v)\nset [score - level v] to [0]\nset [digit place v] to []\nset [digit value v] to [0]\nset rotation style [don't rotate v]\npoint in direction (0)\ngo to x: (0) y: (0)\nkeep score for current level | x: (-175) y: (109) digit width: (13)\ndelete (all) of [level scores v]\nrepeat (length of [level lengths v])\n    add [0] to [level scores v]\nend\n\nwhen I receive [start level - back layer v]\nset [score - level v] to [0]\nset [timer v] to [0]\nif <not <(digit value) = []>> then\n    show\n    go to [front v] layer\n    go [backward v] ((6) - (digit place)) layers\nend\n\ndefine None\nset [digit place v] to [1]\nset [digit value v] to [0]\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\nset [digit value v] to []\nrepeat (2)\n    change [digit place v] by (1)\n    change x by (w)\n    create clone of (_myself_ v)\nend\nset [digit place v] to []\nset [digit value v] to []\n\nwhen I receive [end level v]\nif <(digit place) = []> then\n    change [score - level v] by ((0) - ([floor v] of ((timer) / (10)) ))\n    if <(item (global level) of [level scores v]) < (score - level)> then\n        replace item (global level) of [level scores v] with (score - level)\n    end\n    get current overall score\n    broadcast (update leaderboard v)\nend\nhide\n\nwhen I receive [hud - update score v]\nif <<not <(digit place) = []>> and <(game state - target) = [game]>> then\n    set [digit value v] to (letter (digit place) of (score - level))\n    switch costume to (join (digit value) [s])\n    if <(digit value) = []> then\n        hide\n    else\n        show\n        go to [front v] layer\n        go [backward v] (5) layers\n    end\nend\n\ndefine get current overall score\nset [function - counter v] to [0]\nset [score - total v] to [0]\nrepeat (length of [level lengths v])\n    change [function - counter v] by (1)\n    change [score - total v] by (item (FUNCTION - counter) of [level scores v])\nend\nif <(score - total) < [0]> then\n    set [score - total v] to [0]\nend\n\n@leaderboard\n\nwhen flag clicked\nset [leaderboard - chars list v] to [1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*\(\)_+-={}|\[\];',./:"<>?\`abcdefghijklmnopqrstuvwxyz]\nhide\n\ndefine encode string | string: []\nset [function - counter v] to [0]\nset [function - result v] to []\nrepeat (length of (string))\n    switch costume to (null v)\n    change [function - counter v] by (1)\n    switch costume to (letter (FUNCTION - counter) of (string))\n    if <(costume [number v]) = [95]> then\n        switch costume to (join (letter (FUNCTION - counter) of (string)) [s])\n    end\n    set [function - result v] to (join (FUNCTION - result) (join (letter (2) of ((costume [number v]) + (100))) (letter (3) of ((costume [number v]) + (100)))))\nend\n\ndefine decode string | string: []\nset [function - counter v] to [0]\nset [function - result v] to []\nrepeat ((length of (string)) / (2))\n    change [function - counter v] by (1)\n    set [function - temp v] to (join (letter (((FUNCTION - counter) * (2)) - (1)) of (string)) (letter ((FUNCTION - counter) * (2)) of (string)))\n    set [function - result v] to (join (FUNCTION - result) (letter (FUNCTION - temp) of (LEADERBOARD - chars list)))\nend\n\ndefine encode list | divider: []\nset [function - counter v] to [0]\nset [function - result v] to []\nrepeat (length of [cloud leaderboard data v])\n    change [function - counter v] by (1)\n    set [function - result v] to (join (join (FUNCTION - result) (item (FUNCTION - counter) of [cloud leaderboard data v])) (div))\nend\nencode string | string: (FUNCTION - result)\nset [leaderboard - local data v] to (FUNCTION - result)\n\ndefine decode list | list encoding: [] divider: []\nset [function - counter v] to [0]\nset [function - result v] to []\nset [function - temp v] to []\ndelete (all) of [cloud leaderboard data v]\nrepeat (length of (string))\n    change [function - counter v] by (1)\n    set [function - temp v] to (letter (FUNCTION - counter) of (string))\n    if <(FUNCTION - temp) = (div)> then\n        add (FUNCTION - result) to [cloud leaderboard data v]\n        set [function - result v] to []\n    else\n        set [function - result v] to (join (FUNCTION - result) (FUNCTION - temp))\n    end\nend\n\ndefine None\nif <<(name) = []> and <(score) = []>> then\n    set [function - result v] to (join (place) [. -\n])\nelse\n    set [function - result v] to (join (join (place) [. ]) (join (join (join (score) [ :  ]) (name)) [\n]))\nend\n\ndefine None\ndecode string | string: (LEADERBOARD - local data)\ndecode list | list encoding: (FUNCTION - result) divider: [#]\nset [function - counter v] to [0]\nset [function - temp v] to []\nrepeat (slots)\n    change [function - counter v] by (1)\n    convert to leaderboard entry | username: (item ((slots) + (FUNCTION - counter)) of [cloud leaderboard data v]) score: (item (FUNCTION - counter) of [cloud leaderboard data v]) place: (FUNCTION - counter)\n    set [function - temp v] to (join (FUNCTION - temp) (FUNCTION - result))\nend\n\ndefine None\nset [function - substring v] to []\nset [function - counter v] to [0]\nrepeat ((end index) - (start index))\n    set [function - substring v] to (join (FUNCTION - substring) (letter ((start index) + (FUNCTION - counter)) of (string)))\n    change [function - counter v] by (1)\nend\n\nwhen I receive [display leaderboard v]\nupdate leaderboard | name: (username) score: (score - total) max # of slots: (5)\ndisplay leaderboard | max # of slots: (5) width: (35)\nset [text? v] to (FUNCTION - temp)\nbroadcast (text - leaderboard v)\n\ndefine None\nset [function - temp v] to []\nrepeat ((slots) * (2))\n    set [function - temp v] to (join (FUNCTION - temp) (div))\nend\nencode string | string: (FUNCTION - temp)\nset [leaderboard - local data v] to (FUNCTION - result)\nhandle LEADERBOARD DATA overflow\n\ndefine handle LEADERBOARD DATA overflow\nsubstring | start: (1) end: (129) string: (LEADERBOARD - local data)\nset [☁ leaderboard data 1 v] to (FUNCTION - substring)\nsubstring | start: (129) end: (257) string: (LEADERBOARD - local data)\nset [☁ leaderboard data 2 v] to (FUNCTION - substring)\nsubstring | start: (257) end: (385) string: (LEADERBOARD - local data)\nset [☁ leaderboard data 3 v] to (FUNCTION - substring)\n\ndefine get leaderboard data\nset [leaderboard - local data v] to (join (join (☁ LEADERBOARD DATA 1) (☁ LEADERBOARD DATA 2)) (☁ LEADERBOARD DATA 3))\n\ndefine None\nget leaderboard data\ndecode string | string: (LEADERBOARD - local data)\ndecode list | list encoding: (FUNCTION - result) divider: [#]\nset [function - counter v] to [0]\nset [function - temp v] to [0]\nrepeat until <<(slots) = (FUNCTION - counter)> or <(FUNCTION - temp) = [1]>>\n    change [function - counter v] by (1)\n    if <not <(score) < (item (FUNCTION - counter) of [cloud leaderboard data v])>> then\n        if <not <<(score) = (item (FUNCTION - counter) of [cloud leaderboard data v])> and <(name) = (item ((FUNCTION - counter) + (slots)) of [cloud leaderboard data v])>>> then\n            insert (score) at (FUNCTION - counter) of [cloud leaderboard data v] \n            insert (name) at ((slots) + ((FUNCTION - counter) + (1))) of [cloud leaderboard data v] \n            delete ((slots) + (1)) of [cloud leaderboard data v]\n            delete (((2) * (slots)) + (1)) of [cloud leaderboard data v]\n        end\n        set [function - temp v] to [1]\n    end\nend\nencode list | divider: [#]\nset [leaderboard - local data v] to (FUNCTION - result)\nhandle LEADERBOARD DATA overflow\n\nget leaderboard data\nreset leaderboard | divider: [#] slots: (5)\n\nwhen I receive [update leaderboard v]\nupdate leaderboard | name: (username) score: (score - total) max # of slots: (5)\n\nreset leaderboard | divider: [#] slots: (5)\nupdate leaderboard | name: [canteloupebearstew] score: (101) max # of slots: (5)\nupdate leaderboard | name: [qwertyuiopasdlkjasds] score: (1024) max # of slots: (5)\nupdate leaderboard | name: [xxxKingdomHeartsxxx] score: (9999) max # of slots: (5)\nupdate leaderboard | name: [longusernamef56] score: (104) max # of slots: (5)\nupdate leaderboard | name: [anotherlongusername] score: (3678) max # of slots: (5)\ndisplay leaderboard | max # of slots: (5) width: (35)\nset [text? v] to (FUNCTION - temp)\nbroadcast (text - leaderboard v)\n\n@states\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nset rotation style [don't rotate v]\nset [game state - current v] to [title]\nset [game state - target v] to [title]\nset [credits seen? v] to [0]\nset size to (100) %\nswitch costume to (null v)\n\ndefine change game state | start: [] end: []\nif <(end) = [credits]> then\n    switch costume to (credits v)\n    go to [front v] layer\n    fade (-1)\n    set [game state - current v] to (end)\n    wait (2) seconds\n    broadcast (end level v) and wait\n    if <(credits seen?) = [0]> then\n        set [credits seen? v] to [1]\n        broadcast (credits v)\n        wait (1) seconds\n        fade (1)\n        show\n        set [ghost v] effect to (99)\n    else\n        set [game state - target v] to [level select]\n        broadcast (change state v)\n    end\nelse\n    if <(start) = [game]> then\n        switch costume to (transition v)\n        go to [front v] layer\n        fade (-1)\n        broadcast (end level v) and wait\n        set [game state - current v] to (end)\n        wait (1) seconds\n        fade (1)\n    else\n        if <(end) = [leaderboard]> then\n            broadcast (display leaderboard v)\n        else\n            if <(end) = [game]> then\n                switch costume to (transition v)\n                go to [front v] layer\n                fade (-1)\n                set [game state - current v] to (end)\n                broadcast (start level - back layer v) and wait\n                broadcast (start level - front layer v)\n                fade (1)\n                set [text? v] to [0]\n            else\n                if <<(start) = [credits]> and <(end) = [level select]>> then\n                    set [game state - current v] to (end)\n                    fade (1)\n                end\n            end\n        end\n    end\n    set [game state - current v] to (end)\nend\n\nwhen I receive [change state v]\nchange game state | start: (game state - current) end: (game state - target)\n\nwhen I receive [end logo v]\nset [game state - current v] to [title]\nset [game state - target v] to [title]\nbroadcast (change state v)\n\nwhen this sprite clicked\nif <(game state - current) = [credits]> then\n    broadcast (text - clear dialogue v)\n    go to [front v] layer\n    fade (-1)\n    set [game state - target v] to [title]\n    broadcast (change state v)\n    fade (1)\nend\n\ndefine None\nshow\nset [ghost v] effect to ((50) + ((in\(-1\)/out\(1\)) * (-50)))\nrepeat (20)\n    change [ghost v] effect by ((in\(-1\)/out\(1\)) * (5))\n    set [text? v] to [1]\nend\nset [text? v] to [0]\nif <(in\(-1\)/out\(1\)) = [1]> then\n    hide\nend\n\n@popups\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nset rotation style [don't rotate v]\npoint in direction (90)\nset size to (100) %\n\nwhen I receive [change state v]\nif <(game state - target) = [title]> then\n    if <(game state - current) = [leaderboard]> then\n        broadcast (text - clear dialogue v)\n    end\n    fade and size (1) opacity: (17)\n    switch costume to (null v)\n    hide\nelse\n    if <<(game state - target) = [credits]> or <(game state - target) = [game]>> then\n        wait until <(game state - current) = (game state - target)>\n        switch costume to (null v)\n        hide\n    else\n        wait until <(game state - current) = (game state - target)>\n        switch costume to (game state - target)\n        fade and size (-1) opacity: (17)\n        if <(game state - target) = [help]> then\n            repeat until <not <(game state - target) = [help]>>\n                animate | # frames: (2) speed: (0.5) init costume: (2)\n            end\n        end\n    end\nend\n\ndefine None\ngo to x: (0) y: (0)\nset [ghost v] effect to ((55) + ((in\(-1\)/out\(1\)) * (-45)))\nset size to ((95) + ((in\(-1\)/out\(1\)) * (5))) %\nshow\ngo to [front v] layer\ngo [backward v] (10) layers\nrepeat (5)\n    change [ghost v] effect by ((in\(-1\)/out\(1\)) * (op))\n    change size by ((in\(-1\)/out\(1\)) * (-2))\nend\n\ndefine None\nset [ghost v] effect to ((50) + ((in\(-1\)/out\(1\)) * (-50)))\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\nrepeat (20)\n    change [ghost v] effect by ((in\(-1\)/out\(1\)) * (5))\nend\n\ndefine None\nwait (speed) seconds\nswitch costume to ((init) + (((costume [number v]) + (1)) mod (# frames)))\n\n@effects2\n\nwhen flag clicked\ngo to x: (0) y: (0)\npoint in direction (90)\nset rotation style [all around v]\nhide\nswitch costume to (null v)\nset [ghost v] effect to (0)\nset size to (100) %\nset [overlay - clone type v] to [0]\nset [overlay - panel # v] to [-1]\n\ndefine None\nset [overlay - xpos v] to [0]\nset [overlay - ypos v] to [0]\nset [overlay - clone type v] to (type)\nswitch costume to (c)\nif <(type) = [parallax]> then\n    set [overlay - layer # v] to [1]\n    repeat (layers)\n        set [overlay - panel # v] to [0]\n        repeat (2)\n            create clone of (_myself_ v)\n            change [overlay - panel # v] by (1)\n        end\n        change [overlay - layer # v] by (1)\n        next costume\n    end\nelse\n    if <<(type) = [mouse]> or <(type) = [credits]>> then\n        set [overlay - layer # v] to [1]\n        repeat (layers)\n            create clone of (_myself_ v)\n            change [overlay - layer # v] by (1)\n            next costume\n        end\n    else\n        if <(type) = [miasma]> then\n            set [overlay - panel # v] to [0]\n            repeat (2)\n                create clone of (_myself_ v)\n                change [overlay - panel # v] by (1)\n            end\n        else\n            create clone of (_myself_ v)\n        end\n    end\nend\nset [overlay - clone type v] to [0]\nset [overlay - panel # v] to [-1]\nswitch costume to (null v)\n\ndefine None\ngo to x: (x) y: (y)\npoint in direction ((90) - ((v) * (0.5)))\nshow\ngo to [front v] layer\nset size to (0) %\nset [overlay - angle v] to [0]\nrepeat (10)\n    set [overlay - angle v] to (((overlay - angle) + (v)) mod (360))\n    turn right (([sin v] of (overlay - angle) ) * (dr)) degrees\n    set size to ((size) + (((s) - (size)) * (ds'))) %\nend\nforever\n    set [overlay - angle v] to (((overlay - angle) + (v)) mod (360))\n    turn right (([sin v] of (overlay - angle) ) * (dr)) degrees\n    change size by (([sin v] of (overlay - angle) ) * (ds))\nend\n\ndefine None\nset [overlay - xpos v] to ((480) - (((((camera x) * ((xdist) * (layer))) + (x)) + ((overlay - panel #) * (480))) mod (960)))\nset [overlay - ypos v] to ((0) - (((camera y) * ((ydist) * (layer))) + (y)))\ngo to x: (overlay - xpos) y: (overlay - ypos)\n\nwhen I receive [tick v]\nif <(game state - current) = [game]> then\n    if <(overlay - clone type) = [parallax]> then\n        level parallax | layer #: (overlay - layer #) x dist: (0.1) y dist: (0.1) x offset: (0) y offset: (75)\n    else\n        if <(overlay - clone type) = [miasma]> then\n            clouds | speed: (1) y offset: (100)\n        else\n        end\n    end\nend\n\nwhen I receive [change state v]\nif <(overlay - clone type) = [0]> then\n    if <not <(game state - target) = [game]>> then\n        wait until <(game state - current) = (game state - target)>\n        setup clones | type: [mouse] # of layers: (2) costume: [city3]\n        if <not <(game state - target) = [credits]>> then\n            setup clones | type: [mouse] # of layers: (1) costume: [miasma2]\n        end\n    end\n    if <(game state - target) = [title]> then\n        wait until <(game state - current) = (game state - target)>\n        setup clones | type: [title] # of layers: (1) costume: [title]\n        setup clones | type: [glow] # of layers: (1) costume: [glow]\n    end\nelse\n    hide\n    delete this clone\nend\n\ndefine None\ngo to x: (x) y: (y)\nshow\ngo to [front v] layer\ngo [backward v] (1) layers\nset size to (0) %\nset [overlay - angle v] to [0]\nrepeat (10)\n    turn right (dr) degrees\n    set size to ((size) + (((s) - (size)) * (ds))) %\nend\nforever\n    turn right (dr) degrees\nend\n\ndefine None\ngo to x: (((480) - (((camera x) + (((overlay - panel #) * (480)) + (overlay - xpos))) mod (960))) + (s)) y: ((y) - (camera y))\nset [overlay - xpos v] to (((overlay - xpos) - (s)) mod (960))\n\nwhen I receive [start level - back layer v]\nif <(overlay - clone type) = [0]> then\n    if <(game state - target) = [game]> then\n        setup clones | type: [parallax] # of layers: (2) costume: [city1]\n        setup clones | type: [miasma] # of layers: (1) costume: [miasma]\n    end\nelse\n    hide\n    delete this clone\nend\n\nwhen I start as a clone\nif <(overlay - clone type) = [title]> then\n    title splash | wiggle: (5) turn sweep: (0.2) size speed: (0.2) popup speed: (0.4) x: (0) y: (50) size: (120)\nelse\n    if <(overlay - clone type) = [parallax]> then\n        show\n        go to [front v] layer\n        go [backward v] ((300) - ((overlay - layer #) * (50))) layers\n    else\n        if <(overlay - clone type) = [mouse]> then\n            mouse parallax | layer #: (overlay - layer #) distance: (-0.06) x offset: (0) y offset: (-100) auto? (1)\n        else\n            if <(overlay - clone type) = [miasma]> then\n                show\n                go to [front v] layer\n                go [backward v] (5) layers\n                set [ghost v] effect to (60)\n            else\n                if <(overlay - clone type) = [glow]> then\n                    title splash glow | rot speed: (1) x: (0) y: (50) size speed: (0.2) size: (120)\n                else\n                end\n            end\n        end\n    end\nend\n\ndefine None\nset size to (150) %\nshow\ngo to [front v] layer\ngo [backward v] (20) layers\nif <(a) = [0]> then\n    repeat until <(game state - current) = [game]>\n        go to x: (((mouse x) * ((dist) * (layer))) + (x)) y: (((mouse y) * ((dist) * (layer))) + (y))\n    end\nelse\n    set [overlay - angle v] to [0]\n    repeat until <(game state - current) = [game]>\n        set [overlay - angle v] to (((overlay - angle) + (5)) mod (360))\n        go to x: ((((([cos v] of (overlay - angle) ) * (20)) + (mouse x)) * ((dist) * (layer))) + (x)) y: ((((([sin v] of (overlay - angle) ) * (20)) + (mouse y)) * ((dist) * (layer))) + (y))\n    end\nend\n\nwhen I receive [clear miasma v]\nif <(overlay - clone type) = [miasma]> then\n    set [ghost v] effect to (60)\n    repeat (10)\n        change [ghost v] effect by (4)\n    end\nend\n\n@cutscene\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset rotation style [left-right v]\npoint in direction (90)\nhide\nset [cutscene animation frame v] to [0]\nset [cutscene xvel v] to [0]\nset [cutscene yvel v] to [0]\n\nwhen I receive [reset level v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [cutscene1 v]\ndrone enter | text index: (1) camera x: ((player xpos) + (150)) camera y: (20)\ndrone scroll to target and back | start x: ((player xpos) + (150)) start y: (20) target x: (2300) target y: (60)\ndrone exit | text index: (2)\n\nwhen I receive [cutscene2 v]\ndrone enter | text index: (3) camera x: ((player xpos) + (150)) camera y: (60)\ndrone exit | text index: (4)\n\nwhen I receive [cutscene3 v]\ndrone enter | text index: (5) camera x: ((player xpos) + (150)) camera y: (20)\ndrone scroll to target and back | start x: ((player xpos) + (150)) start y: (20) target x: (500) target y: (-150)\ndrone exit | text index: (6)\n\nwhen I receive [cutscene4 v]\ndrone enter | text index: (7) camera x: ((player xpos) + (150)) camera y: (-100)\ndrone scroll to target and back | start x: ((player xpos) + (150)) start y: (-100) target x: (1640) target y: (-100)\ndrone exit | text index: (8)\n\nwhen I receive [cutscene5 v]\ndrone enter | text index: (9) camera x: ((player xpos) + (150)) camera y: (20)\ndrone exit | text index: (10)\n\nwhen I receive [cutscene6 v]\ndrone enter | text index: (11) camera x: ((player xpos) + (150)) camera y: (20)\ndrone exit | text index: (12)\n\ndefine None\nset [cutscene xvel v] to (((tx) - (x position)) * (sx))\nset [cutscene yvel v] to (((ty) - (y position)) * (sy))\nchange x by (cutscene xvel)\nchange y by (cutscene yvel)\n\ndefine None\nset [cutscene animation frame v] to (((cutscene animation frame) + (s)) mod (f))\nswitch costume to ([floor v] of ((c) + (cutscene animation frame)) )\n\ndefine None\nchange [camera x v] by (((tx) - (camera x)) * (sx))\nchange [camera y v] by (((ty) - (camera y)) * (sy))\n\ndefine None\nset [cutscene yvel v] to (((cutscene yvel) + (speed)) mod (360))\nchange y by ((range) * ([sin v] of (cutscene yvel) ))\n\ndefine None\nrepeat until <([abs v] of ((round (camera x)) - (round (tx))) ) < [10]>\n    smooth camera glide | target: (tx) (ty) speed: (0.2) (0.2)\n    animate | # of frames: (6) base costume: (1) speed: (0.5)\n    bob | speed: (10) range: (0.5)\nend\nrepeat (60)\n    animate | # of frames: (6) base costume: (1) speed: (0.5)\n    bob | speed: (10) range: (0.5)\nend\nrepeat until <([abs v] of ((round (camera x)) - (round (sx))) ) < [10]>\n    smooth camera glide | target: (sx) (sy) speed: (0.2) (0.2)\n    animate | # of frames: (6) base costume: (1) speed: (0.5)\n    bob | speed: (10) range: (0.5)\nend\n\ndefine None\nset [player xvel v] to [0]\nwait until <(time midair) < [2]>\nset [text? v] to [1]\nset [player move dir v] to [0]\nset [player yvel v] to [0]\nset [player move mode v] to [f]\nrepeat until <([abs v] of ((round (camera x)) - (round (tx))) ) < [10]>\n    smooth camera glide | target: (tx) (ty) speed: (0.05) (0.05)\nend\ngo to x: (240) y: (180)\nswitch costume to (drone1 v)\nshow\ngo to [front v] layer\nrepeat until <([abs v] of (round (x position)) ) < [10]>\n    smooth glide | target: (0) (0) speed: (0.05) (0.05)\n    animate | # of frames: (6) base costume: (1) speed: (0.5)\nend\nset [text? v] to (item (i) of [cutscene text v])\nbroadcast (text - dialogue v)\nrepeat until <(text?) = [0]>\n    animate | # of frames: (6) base costume: (1) speed: (0.5)\n    bob | speed: (10) range: (0.5)\nend\nset [text? v] to [1]\n\ndefine None\nset [text? v] to (item (i) of [cutscene text v])\nbroadcast (text - dialogue v)\nrepeat until <(text?) = [0]>\n    animate | # of frames: (6) base costume: (1) speed: (0.5)\n    bob | speed: (10) range: (0.5)\nend\nset [text? v] to [1]\nrepeat until <(round (y position)) > [170]>\n    smooth glide | target: (0) (250) speed: (0.05) (0.05)\n    animate | # of frames: (6) base costume: (1) speed: (0.5)\nend\nhide\nset [player move mode v] to [w]\nset [text? v] to [0]\n\ndefine None\nset rotation style [don't rotate v]\nturn right (5) degrees\ngo to x: ((((([cos v] of (direction) ) * (20)) + (mouse x)) * (dist)) + (x)) y: ((((([sin v] of (direction) ) * (20)) + (mouse y)) * (dist)) + (y))\n\nwhen I receive [change state v]\nhide\n\nwhen I receive [credits v]\nset [camera x v] to [0]\nset [camera y v] to [0]\nset size to (120) %\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\ngo to x: (0) y: (-100)\nrepeat until <([abs v] of (round (y position)) ) < [5]>\n    smooth glide | target: (0) (0) speed: (0) (0.05)\n    animate | # of frames: (3) base costume: (7) speed: (0.5)\n    set [ghost v] effect to ((0) - (y position))\nend\nbroadcast (text - credits v)\nrepeat until <not <(game state - target) = [credits]>>\n    animate | # of frames: (3) base costume: (7) speed: (0.5)\n    mouse parallax | distance: (-0.09) x offset: (0) y offset: (0)\nend\n\n@logo2\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset rotation style [all around v]\npoint in direction (30)\nswitch costume to (costume1 v)\nset [ghost v] effect to (0)\nhide\nrender (90) (1) (1)\nrender (90) (2) (2)\nrender (30) (2) (3)\nrender (-30) (3) (4)\nrender (-90) (2) (5)\nrender (-150) (4) (6)\nrender (-210) (2) (7)\nwait (1) seconds\nrender (-270) (5) (0)\nwait (1.5) seconds\nbroadcast (end logo v)\n\nwhen I receive [end logo v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\ndefine None\nset [logo clone# v] to (clone#)\nswitch costume to (costume #)\ngo to x: (0) y: (0)\npoint in direction (direction)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(costume [number v]) = [1]> then\n    show\n    go to [front v] layer\nelse\n    if <<(costume [number v]) > [1]> and <[5] > (costume [number v])>> then\n        set [logo clone# v] to ((3) * (logo clone#))\n        set [ghost v] effect to (100)\n        show\n        go to [front v] layer\n        forever\n            if <(logo clone#) > [0]> then\n                change [logo clone# v] by (-1)\n                if <(logo clone#) = [0]> then\n                    set [logo ghost effect v] to [100]\n                    repeat until <(round (logo ghost effect)) = [0]>\n                        change [logo ghost effect v] by (((0) - (logo ghost effect)) * (0.1))\n                        set [ghost v] effect to (logo ghost effect)\n                        turn right (3) degrees\n                    end\n                end\n            end\n            turn right (3) degrees\n        end\n    else\n        set [ghost v] effect to (100)\n        show\n        go to [front v] layer\n        repeat (25)\n            change [ghost v] effect by (-4)\n        end\n    end\nend\n\n@thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\n\n