grassland a multiplayer scrolling platformer
@Stage\n\nwhen flag clicked\nswitch backdrop to (title v)\n\nwhen I receive [start game v]\nswitch backdrop to (woods v)\n\n@player\n\nwhen I receive [hurt v]\nchange [player health v] by (-1)\nbroadcast (HUD - health v)\nif <(player health) < [1]> then\n    hide\n    set [text? v] to [1]\n    broadcast (effect - death v) and wait\n    wait (1.5) seconds\n    broadcast (cutscene - game finish v)\nelse\n    reset (1)\n    repeat (3)\n        set [ghost v] effect to (50)\n        wait (0.05) seconds\n        set [ghost v] effect to (0)\n        wait (0.05) seconds\n    end\nend\n\ndefine animate costume <>\nif <walking?> then\n    set [animation frame v] to (((animation frame) + (0.4)) mod (16))\n    switch costume to ([floor v] of (((animation frame) mod (8)) + (2)) )\nelse\n    if <(climbing?) = [1]> 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        switch costume to (([floor v] of (animation frame) ) + (13))\n    else\n        if <[15] < (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\nend\n\nwhen flag clicked\nhide\nset size to (150) %\nset rotation style [left-right v]\ngo to x: (0) y: (-130)\npoint in direction (90)\nset [max speed v] to [8]\nset [max health v] to [3]\nset [friction v] to [0.5]\nset [jump power v] to [12]\nset [climb speed v] to [3]\nset [wall jumping? v] to [0]\nset [player xvel v] to [0]\nset [player yvel v] to [0]\nset [player xpos v] to [-150]\nset [player ypos v] to [-100]\nset [player spawn x v] to [-150]\nset [player spawn y v] to [30]\nset [camera x v] to [0]\nset [camera y v] to [0]\nset [climbing? v] to [0]\nset [underwater? v] to [0]\nset [edit mode? v] to [0]\nset [lantern? v] to [0]\nset [jumping allowed? v] to [1]\nset [player health v] to (MAX HEALTH)\nset [animation frame v] to [0]\nset [time midair v] to [0]\nset [slope v] to [0]\nset [player air v] to [8]\nset [level v] to [1]\nset [cutscene name v] to [intro1]\nset [equipped item v] to [0]\nset [equipped inventory slot v] to [0]\nset [object index v] to [0]\nset [item v] to [0]\n\ndefine None\nif <(climbing?) = [1]> then\n    set [player xvel v] to ((CLIMB SPEED) * (dir))\nelse\n    point in direction ((90) * (dir))\n    change [player xvel v] by (dir)\n    if <((MAX SPEED) - ((underwater?) * ((MAX SPEED) / (2)))) < ([abs v] of (player xvel) )> then\n        change [player xvel v] by ((0) - (dir))\n    end\nend\ndetect slope (player xvel) <[0] = [1]>\nanimate costume <(climbing?) = [0]>\n\ndefine None\nset [slope v] to [0]\nif <sliding?> then\n    set [player xvel v] to (((xspeed) * (FRICTION)) * ((1) - (climbing?)))\nend\nchange x by (player xvel)\nif <([abs v] of (x position) ) < [240]> then\n    change [player xpos v] by (player xvel)\nend\nif <not <(round (player xvel)) = [0]>> then\n    repeat until <<not <<touching (level hitbox v)?> or <touching (solid objects v)?>>> or <(slope) > [8]>>\n        change y by (1)\n        change [player ypos v] by (1)\n        change [slope v] by (1)\n    end\n    if <(slope) > [8]> then\n        change y by ((0) - (slope))\n        change [player ypos v] by ((0) - (slope))\n        change x by ((0) - (player xvel))\n        change [player xpos v] by ((0) - (player xvel))\n        set [player xvel v] to [0]\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(WALL JUMPING?) = [1]>> then\n            set [player xvel v] to ((0) - (xspeed))\n            set [player yvel v] to (JUMP POWER)\n            set [time midair v] to [0]\n        end\n    end\nend\nscroll x\nscroll y (20) (-110) (300)\n\nwhen I receive [reset level v]\nreset (1)\nset [player health v] to [3]\nbroadcast (HUD - health v)\n\nwhen I receive [hud - edit mode v]\nif <(edit mode?) = [1]> then\n    stop [other scripts in sprite v]\n    set [player xvel v] to [0]\n    set [player yvel v] to [0]\n    repeat until <(edit mode?) = [0]>\n        go to x: ((player xpos) - (camera x)) y: ((player ypos) - (camera y))\n    end\n    set [text? v] to [1]\nelse\n    wait (0.05) seconds\n    main\nend\n\nwhen I receive [start new level v]\nreset (0)\n\nwhen I receive [start game v]\nreset (0)\nmain\n\ndefine None\nhide\nset [text? v] to [1]\nset [climbing? v] to [0]\nset [underwater? v] to [0]\nset [edit mode? v] to [0]\nset [lantern? v] to [0]\nset [player air v] to [8]\nset [player xvel v] to [0]\nset [player yvel v] to [0]\nset [jumping allowed? v] to [1]\nif <(scroll animation?) = [1]> then\n    repeat until <<(round (camera x)) = [0]> and <(round (camera y)) = [0]>>\n        set [camera x v] to ((camera x) * (0.5))\n        set [camera y v] to ((camera y) * (0.5))\n    end\nelse\n    set [camera x v] to [0]\n    set [camera y v] to [0]\nend\nset [player xpos v] to [-150]\nset [player ypos v] to [30]\ngo to x: (player xpos) y: (player ypos)\npoint in direction (90)\nshow\ngo to [front v] layer\ngo [backward v] (1) layers\nset [text? v] to [0]\n\ndefine None\nif <(player ypos) > (scroll upper bound)> then\n    if <(player ypos) < ((scroll upper bound) + (drift range))> then\n        set [camera y v] to (((player ypos) - (scroll upper bound)) + (((scroll upper bound) / (drift range)) * ((player ypos) - (scroll upper bound))))\n    else\n        set [camera y v] to (player ypos)\n    end\nelse\n    if <(player ypos) < (scroll lower bound)> then\n        if <(player ypos) > ((scroll lower bound) - (drift range))> then\n            set [camera y v] to (((player ypos) - (scroll lower bound)) - (((scroll lower bound) / (drift range)) * ((player ypos) - (scroll lower bound))))\n        else\n            set [camera y v] to (player ypos)\n        end\n    else\n        set [camera y v] to [0]\n    end\nend\nset y to ((player ypos) - (camera y))\n\ndefine scroll x\nif <<(player xpos) < [0]> or <(player xpos) > ((480) * ((item (level) of [level lengths v]) - (1)))>> then\n    if <(x position) > [235]> then\n        hide\n        set [text? v] to [1]\n        broadcast (cutscene - next level v)\n    end\nelse\n    set [camera x v] to (player xpos)\nend\nset x to ((player xpos) - (camera x))\n\ndefine detect ceiling/ground <>\nif <(climbing?) = [0]> then\n    if <<(underwater?) = [1]> and <(time midair) > [0]>> then\n        change [player yvel v] by (((-3) - (player yvel)) * (0.2))\n    else\n        change [time midair v] by (1)\n        change [player yvel v] by (-1)\n    end\nend\nchange y by (player yvel)\nchange [player ypos v] by (player yvel)\nrepeat until <not <<touching (level hitbox v)?> or <touching (solid objects v)?>>>\n    if <midair> then\n        change y by (-1)\n        change [player ypos v] by (-1)\n    else\n        change y by (1)\n        change [player ypos v] by (1)\n        set [time midair v] to [0]\n    end\n    set [player yvel v] to [0]\nend\n\ndefine player jump\nif <(climbing?) = [1]> then\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        set [player yvel v] to (CLIMB SPEED)\n    else\n        if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n            set [player yvel v] to ((0) - (CLIMB SPEED))\n        else\n            set [player yvel v] to [0]\n        end\n    end\n    set [time midair v] to [1]\nelse\n    if <(underwater?) = [1]> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [player yvel v] to ((JUMP POWER) / (2))\n            set [time midair v] to [1]\n        end\n    else\n        if <(jumping allowed?) = [1]> then\n            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                if <(time midair) < [3]> then\n                    set [player yvel v] to (JUMP POWER)\n                    broadcast (sound - jump v)\n                end\n            end\n        end\n    end\nend\n\ndefine main\nset [ghost v] effect to (0)\nshow\ngo to [front v] layer\nforever\n    if <(text?) = [0]> then\n        switch costume to (hitbox v)\n        player jump\n        detect ceiling/ground <(player yvel) > [0]>\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            player walk (1)\n        else\n            if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n                player walk (-1)\n            else\n                detect slope (player xvel) <[0] = [0]>\n                animate costume <[0] = [1]>\n            end\n        end\n    end\n    broadcast (tick v)\nend\n\n@level visual\n\nwhen flag clicked\nhide\nswitch costume to (1.1 v)\nset size to (400) %\ngo to x: (0) y: (0)\nset rotation style [don't rotate v]\ncostume name accessor\nlevel lengths accessor [05,10,09,09,05,10,10,02,]\nset [panel # v] to [0]\nrepeat (2)\n    change [panel # v] by (1)\n    switch costume to (join (level) (join [.] (panel #)))\n    create clone of (_myself_ v)\nend\nset [panel # v] to [0]\n\ndefine costume name accessor\ndelete (all) of [level costume names v]\nswitch costume to (1.1 v)\nadd ([costume name v] of [level visual v]) to [level costume names v]\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    add ([costume name v] of [level visual v]) to [level costume names v]\n    next costume\nend\n\ndefine switch costume? []\nif <not <(item (costume [number v]) of [level costume names v]) = (costume name)>> then\n    switch costume to (costume name)\nend\n\ndefine level lengths accessor []\nset [counter v] to [0]\ndelete (all) of [level lengths v]\nrepeat ((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\nwhen I start as a clone\ngo to [front v] layer\ngo [backward v] (30) layers\n\nwhen I receive [tick v]\nif <(panel #) > [0]> then\n    go to x: ((480) - (((camera x) + (((panel #) mod (2)) * (480))) mod (960))) y: ((0) - (camera y))\n    switch costume? (join (join (level) [.]) ((([ceiling v] of (((camera x) + (((panel #) mod (2)) * (480))) / (960)) ) * (2)) - ((panel #) mod (2))))\nend\n\nwhen I receive [start game v]\nif <(panel #) > [0]> then\n    show\nend\n\n@level hitbox\n\nwhen flag clicked\nhide\nswitch costume to (1.1 v)\nset size to (400) %\ngo to x: (0) y: (0)\nset rotation style [don't rotate v]\nset [ghost v] effect to (100)\nset [panel # v] to [0]\nrepeat (2)\n    change [panel # v] by (1)\n    switch costume to (join (level) (join [.] (panel #)))\n    create clone of (_myself_ v)\nend\nset [panel # v] to [0]\n\ndefine switch costume? []\nif <not <(item (costume [number v]) of [level costume names v]) = (costume name)>> then\n    switch costume to (costume name)\nend\n\nwhen I receive [hud - edit mode v]\nset [ghost v] effect to (((1) - (edit mode?)) * (100))\n\nwhen I receive [tick v]\nif <(panel #) > [0]> then\n    go to x: ((480) - (((camera x) + (((panel #) mod (2)) * (480))) mod (960))) y: ((0) - (camera y))\n    switch costume? (join (join (level) [.]) ((([ceiling v] of (((camera x) + (((panel #) mod (2)) * (480))) / (960)) ) * (2)) - ((panel #) mod (2))))\nend\n\nwhen I receive [start game v]\nif <(panel #) > [0]> then\n    show\nend\n\n@parallax\n\nwhen flag clicked\nswitch costume to (mist2 v)\ngo [backward v] (50) layers\ngo to x: (0) y: (0)\nhide\nset rotation style [don't rotate v]\nset [layer # v] to [0]\nrepeat (3)\n    set [parallaxpos v] to [-480]\n    change [layer # v] by (1)\n    repeat (2)\n        change [parallaxpos v] by (480)\n        create clone of (_myself_ v)\n    end\nend\nset [layer # v] to [0]\n\ndefine None\nset x to ((480) - ((((camera x) / ((4) / (layer #))) + (parallaxPos)) mod (960)))\nset y to ((0) - ((camera y) / ((4) / (layer #))))\nset [parallaxpos v] to (((parallaxPos) - (xvel)) mod (960))\n\nwhen I start as a clone\nset x to (parallaxPos)\nswitch costume to (layer #)\nif <(layer #) = [3]> then\n    show\n    set [ghost v] effect to (70)\n    forever\n        scroll (1)\n    end\nelse\n    forever\n        scroll (0)\n    end\nend\n\nwhen I receive [start game v]\nif <(layer #) > [0]> then\n    show\nend\n\nwhen I receive [cutscene - intro v]\nhide\n\n@objects\n\nwhen flag clicked\nset [object index v] to [0]\nset [solid obj. index v] to [0]\nset rotation style [left-right v]\npoint in direction (0)\nswitch costume to (blank v)\nset size to (100) %\nhide\nset [object vel v] to [0]\nset [counter v] to [0]\nset [timer v] to [0]\nset [object master list index v] to [0]\nset [object touching list index v] to [0]\n\nwhen I receive [spawn object \(editor\) v]\nif <(costume [number v]) = [1]> then\n    create object\nend\n\ndefine create object\nif <(costume [number v]) = [1]> then\n    set [object master list index v] to (item (object index) of [objects v])\n    set [object level v] to ((join (letter (1) of (object master list index)) (letter (2) of (object master list index))) - (10))\n    set [object xpos v] to ((join (join (join (letter (3) of (object master list index)) (letter (4) of (object master list index))) (letter (5) of (object master list index))) (letter (6) of (object master list index))) - (2000))\n    set [object ypos v] to ((join (join (join (letter (7) of (object master list index)) (letter (8) of (object master list index))) (letter (9) of (object master list index))) (letter (10) of (object master list index))) - (2000))\n    set [object costume id v] to ((join (letter (11) of (object master list index)) (letter (12) of (object master list index))) - (10))\n    set [object animated frame# v] to ((join (letter (13) of (object master list index)) (letter (14) of (object master list index))) - (10))\n    set [object behavior id v] to ((join (letter (15) of (object master list index)) (letter (16) of (object master list index))) - (10))\n    set [object item id v] to ((join (letter (17) of (object master list index)) (letter (18) of (object master list index))) - (10))\n    set [object key item v] to ((join (letter (19) of (object master list index)) (letter (20) of (object master list index))) - (10))\n    set [object reward item v] to ((join (letter (21) of (object master list index)) (letter (22) of (object master list index))) - (10))\n    set [object new costume# v] to ((join (letter (23) of (object master list index)) (letter (24) of (object master list index))) - (10))\n    set [object new behavior id v] to ((join (letter (25) of (object master list index)) (letter (26) of (object master list index))) - (10))\n    set [object text v] to []\n    set [counter v] to [0]\n    repeat ((length of (object master list index)) - (26))\n        change [counter v] by (1)\n        set [object text v] to (join (object text) (letter ((counter) + (26)) of (object master list index)))\n    end\n    set [counter v] to [0]\n    set [object master list index v] to (object index)\n    if <(object behavior ID) = [3]> then\n        add [0] to [touching vines? v]\n        set [object touching list index v] to (length of [touching vines? v])\n    else\n        if <<(object behavior ID) = [12]> or <(object behavior ID) = [13]>> then\n            add (object master list index) to [solid objects v]\n        end\n    end\n    create clone of (_myself_ v)\nend\n\ndefine behavior\nif <(object behavior ID) = [0]> then\n    decor / effects\nelse\n    if <(object behavior ID) = [1]> then\n        dialogue\n    else\n        if <(object behavior ID) = [2]> then\n            bouncy\n        else\n            if <(object behavior ID) = [3]> then\n                vines/ladder\n            else\n                if <(object behavior ID) = [4]> then\n                    if <touching (player v)?> then\n                        broadcast (hurt v)\n                    end\n                else\n                    if <(object behavior ID) = [5]> then\n                        sliding danger\n                    else\n                        if <(object behavior ID) = [6]> then\n                            falling danger\n                        else\n                            if <(object behavior ID) = [7]> then\n                                water\n                            else\n                                if <(object behavior ID) = [8]> then\n                                    item\n                                else\n                                    if <(object behavior ID) = [9]> then\n                                        mobile danger (2)\n                                    else\n                                        if <(object behavior ID) = [10]> then\n                                            container\n                                        else\n                                            if <(object behavior ID) = [11]> then\n                                                slime/sand\n                                            else\n                                                if <(object behavior ID) = [13]> then\n                                                    door\n                                                else\n                                                    if <(object behavior ID) = [14]> then\n                                                        if <(distance to [player v]) < [70]> then\n                                                            broadcast (object text)\n                                                            delete this clone\n                                                        end\n                                                    else\n                                                        if <(object behavior ID) = [15]> then\n                                                            checkpoint\n                                                        else\n                                                        end\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [start new level v]\ndelete clone\nspawn objects from list\n\nwhen I receive [reset level v]\ndelete clone\nspawn objects from list\n\nwhen I receive [start game v]\ndelete clone\nspawn objects from list\n\nwhen I receive [delete object v]\nif <(object master list index) > (object index)> then\n    change [object master list index v] by (-1)\nend\n\nwhen I receive [delete vine/ladder v]\nif <(object touching list index) > (object index)> then\n    change [object touching list index v] by (-1)\nend\n\ndefine delete clone\ndelete this clone\n\nwhen I receive [end game v]\ndelete this clone\n\nwhen [x v] key pressed\nif <touching (editor v)?> then\n    delete (object master list index) of [objects v]\n    set [object index v] to (object master list index)\n    broadcast (delete object v) and wait\n    if <(object behavior ID) = [3]> then\n        delete (object touching list index) of [touching vines? v]\n        set [object index v] to (object touching list index)\n        broadcast (delete vine/ladder v) and wait\n    end\n    delete this clone\nend\n\ndefine sliding danger\nturn right (2) degrees\nchange [object xpos v] by ((3) * ([sin v] of (direction) ))\nif <touching (player v)?> then\n    if <<((object ypos) + (40)) < (player xpos)> and <(player yvel) < [0]>> then\n        broadcast (sound - boing v)\n        set [player yvel v] to ((JUMP POWER) - (2))\n        set [effect xpos v] to (object xpos)\n        set [effect ypos v] to ((object ypos) + (15))\n        broadcast (effect - slime v)\n        set [object item id v] to [1]\n        set [object behavior id v] to [8]\n        set [object animated frame# v] to [0]\n        switch costume to (heart v)\n    else\n        broadcast (hurt v)\n    end\nend\n\ndefine dialogue\nif <<(distance to [player v]) < [50]> and <(text?) = [0]>> then\n    point towards (player v)\n    broadcast (HUD - space v)\n    if <key (space v) pressed?> then\n        set [text? v] to (object text)\n        broadcast (text - dialogue v) and wait\n        wait until <not <key (space v) pressed?>>\n    end\nend\n\ndefine bouncy\nif <<touching (player v)?> and <(player yvel) < [0]>> then\n    set [player yvel v] to ((JUMP POWER) + (7))\n    broadcast (sound - boing v)\nend\n\ndefine vines/ladder\nif <<<([abs v] of ((object xpos) - (player xpos)) ) < [20]> and <touching (player v)?>> and <(time midair) > [0]>> then\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<<key (down arrow v) pressed?> or <key (s v) pressed?>> or <(climbing?) = [1]>>> then\n        replace item (object touching list index) of [touching vines? v] with [1]\n    end\nelse\n    replace item (object touching list index) of [touching vines? v] with [0]\nend\nif <[touching vines? v] contains [1]?> then\n    set [climbing? v] to [1]\nelse\n    set [climbing? v] to [0]\nend\n\ndefine water\nif <<([abs v] of ((player xpos) - ((object xpos) + (120))) ) < [120]> and <<(player ypos) < (object ypos)> and <(player ypos) > ((object ypos) - (30))>>> then\n    if <(underwater?) = [0]> then\n        broadcast (sound - splash v)\n        set [underwater? v] to [1]\n        broadcast (HUD - air v)\n        broadcast (sound - bubbling v)\n    end\nelse\n    if <<([abs v] of ((player xpos) - ((object xpos) + (120))) ) < [120]> and <<(player ypos) > (object ypos)> and <(player ypos) < ((object ypos) + (10))>>> then\n        if <(underwater?) = [1]> then\n            broadcast (sound - splash v)\n            set [underwater? v] to [0]\n            broadcast (HUD - air v)\n        end\n    end\nend\n\ndefine container\nif <<(distance to [player v]) < [50]> and <(text?) = [0]>> then\n    broadcast (HUD - space v)\n    if <key (space v) pressed?> then\n        if <<(object key item) = [0]> or <<(equipped item) = (object key item)> and <[inventory v] contains (object key item)?>>> then\n            if <not <(object new costume#) = [0]>> then\n                repeat until <(costume [number v]) = (object new costume#)>\n                    next costume\n                    wait (0.2) seconds\n                end\n            end\n            set [item v] to (object key item)\n            broadcast (remove item v) and wait\n            wait until <(text?) = [0]>\n            set [item v] to (object reward item)\n            broadcast (add item v) and wait\n            wait until <not <key (space v) pressed?>>\n            if <(object new behavior ID) = [0]> then\n                repeat (10)\n                    change [ghost v] effect by (10)\n                end\n                delete this clone\n            else\n                set [object behavior id v] to (object new behavior ID)\n                if <(object behavior ID) = [3]> then\n                    add [0] to [touching vines? v]\n                    set [object touching list index v] to (length of [touching vines? v])\n                else\n                end\n            end\n        else\n            set [text? v] to (object text)\n            broadcast (text - dialogue v) and wait\n        end\n    end\nend\n\ndefine door\nshow\nif <<<([abs v] of ((object xpos) - (player xpos)) ) < [50]> and <([abs v] of ((object ypos) - (player ypos)) ) < [100]>> and <(text?) = [0]>> then\n    broadcast (HUD - space v)\n    if <key (space v) pressed?> then\n        if <<(equipped item) = (object key item)> and <[inventory v] contains (object key item)?>> then\n            if <(object new costume#) = [0]> then\n                repeat (25)\n                    change [ghost v] effect by (4)\n                end\n                set [item v] to (object key item)\n                broadcast (remove item v) and wait\n                wait until <(text?) = [0]>\n                set [item v] to (object reward item)\n                broadcast (add item v) and wait\n                set [object index v] to (object master list index)\n                broadcast (opened door v)\n                delete this clone\n            else\n                repeat until <(costume [number v]) = (object new costume#)>\n                    next costume\n                    wait (0.2) seconds\n                end\n                set [object costume id v] to (object new costume#)\n                set [item v] to (object key item)\n                broadcast (remove item v) and wait\n                wait until <(text?) = [0]>\n                set [item v] to (object reward item)\n                broadcast (add item v) and wait\n                set [object index v] to (object master list index)\n                broadcast (opened door v)\n                set [object behavior id v] to (object new behavior ID)\n            end\n        else\n            set [text? v] to (object text)\n            broadcast (text - dialogue v) and wait\n        end\n        wait until <not <key (space v) pressed?>>\n    end\nend\n\ndefine item\nif <touching (player v)?> then\n    if <(object item ID) = [1]> then\n        if <(player health) < (MAX HEALTH)> then\n            change [player health v] by (1)\n        end\n        broadcast (HUD - health v)\n    else\n        set [item v] to (object item ID)\n        broadcast (add item v)\n    end\n    delete this clone\nend\n\ndefine slime/sand\nif <touching (player v)?> then\n    set [jumping allowed? v] to [0]\n    set [player xvel v] to ((player xvel) * (0.5))\nelse\n    set [jumping allowed? v] to [1]\nend\n\ndefine falling danger\nif <<(distance to [player v]) < [150]> or <(object vel) < [0]>> then\n    change [object vel v] by (-1)\n    change [object ypos v] by (object vel)\nend\nif <<<touching (level hitbox v)?> or <touching (player v)?>> and <(object vel) < [-10]>> then\n    if <touching (player v)?> then\n        broadcast (hurt v)\n    end\n    set [effect xpos v] to (object xpos)\n    set [effect ypos v] to (object ypos)\n    broadcast (effects - shards v)\n    delete this clone\nend\n\ndefine None\nif <(underwater?) = [1]> then\n    point towards (player v)\n    set [object vel v] to (((object vel) + (3)) mod (360))\n    change [object xpos v] by ((speed) * ([sin v] of (direction) ))\n    set x to (round ((object xpos) - (camera x)))\n    if <touching (level hitbox v)?> then\n        change [object xpos v] by ((0) - ((speed) * ([sin v] of (direction) )))\n        set x to (round ((object xpos) - (camera x)))\n    end\n    change [object ypos v] by ((speed) * ([cos v] of (direction) ))\n    set y to (round ((object ypos) - (camera y)))\n    if <touching (level hitbox v)?> then\n        change [object ypos v] by ((0) - ((speed) * ([cos v] of (direction) )))\n        set y to (round ((object ypos) - (camera y)))\n    end\n    if <touching (player v)?> then\n        broadcast (hurt v)\n    end\nelse\n    turn right (pick random (-3) to (3)) degrees\n    change [object xpos v] by ((speed) * ([sin v] of (direction) ))\n    go to x: (round ((object xpos) - (camera x))) y: (round ((object ypos) - (camera y)))\n    if <touching (level hitbox v)?> then\n        change [object xpos v] by ((0) - ((speed) * ([sin v] of (direction) )))\n        go to x: (round ((object xpos) - (camera x))) y: (round ((object ypos) - (camera y)))\n    end\nend\n\nwhen I receive [hud - edit mode v]\nif <<(costume [number v]) > [1]> and <<<(object behavior ID) = [14]> or <<(costume [number v]) = [31]> and <(object behavior ID) = [0]>>> or <(object behavior ID) = [15]>>> then\n    if <(edit mode?) = [1]> then\n        show\n        set [ghost v] effect to (70)\n    else\n        set [ghost v] effect to (100)\n    end\nend\n\nwhen I receive [tick v]\nif <(costume [number v]) > [1]> then\n    go to x: ((object xpos) - (camera x)) y: ((object ypos) - (camera y))\n    if <<(round (x position)) = (round ((object xpos) - (camera x)))> and <(round (y position)) = (round ((object ypos) - (camera y)))>> then\n        show\n        if <(counter) = [1]> then\n            set [counter v] to [0]\n        end\n    else\n        hide\n        if <(counter) = [0]> then\n            set [counter v] to [1]\n        end\n    end\nend\n\nwhen I start as a clone\nswitch costume to (object costume ID)\ngo to [front v] layer\ngo [backward v] (10) layers\nif <(object behavior ID) = [12]> then\n    hide\n    delete this clone\nend\nif <<(object behavior ID) = [14]> or <<(costume [number v]) = [31]> and <(object behavior ID) = [0]>>> then\n    if <(edit mode?) = [1]> then\n        set [ghost v] effect to (70)\n    else\n        set [ghost v] effect to (100)\n    end\nend\nforever\n    if <<(edit mode?) = [0]> and <(counter) = [0]>> then\n        behavior\n        if <(object animated frame#) > [0]> then\n            animate (10) (object animated frame#)\n        end\n    end\nend\n\ndefine None\nset [timer v] to (((timer) + (speed)) mod ((frames) * (100)))\nif <((timer) mod (100)) = [0]> then\n    switch costume to ((object costume ID) + ((timer) / (100)))\nend\n\ndefine spawn objects from list\nset [object index v] to [0]\ndelete (all) of [solid objects v]\ndelete (all) of [touching vines? v]\nset [object touching list index v] to [0]\nrepeat (length of [objects v])\n    change [object index v] by (1)\n    if <((join (letter (1) of (item (object index) of [objects v])) (letter (2) of (item (object index) of [objects v]))) - (10)) = (level)> then\n        create object\n    end\nend\nbroadcast (spawn solid objects v)\n\ndefine decor / effects\nif <(object animated frame#) = [0]> then\n    set [timer v] to (((timer) + (1)) mod (61))\n    if <(timer) = [60]> then\n        set [effect xpos v] to (object xpos)\n        set [effect ypos v] to (object ypos)\n        broadcast (join [effect - ] (object text))\n    end\nend\n\ndefine checkpoint\nif <(distance to [player v]) < [50]> then\n    set [player spawn x v] to (object xpos)\n    set [player spawn y v] to (object ypos)\nend\n\n@inventory\n\nwhen flag clicked\ndelete (all) of [inventory v]\ndelete (all) of [level inventory v]\nset [inventory slot v] to [0]\nset [inventory item id v] to [0]\nset [inventory item quantity v] to [0]\nset [golden eggs v] to [0]\nhide\ngo to x: (0) y: (-120)\nset rotation style [don't rotate v]\npoint in direction (0)\nswitch costume to (inventory v)\ncreate clone of (_myself_ v)\nswitch costume to (item marker v)\ncreate clone of (_myself_ v)\nswitch costume to (null v)\n\nwhen I receive [hud - open inventory v]\nif <(costume [number v]) = [2]> then\n    go to [front v] layer\n    repeat until <(round (y position)) = [0]>\n        set y to ((y position) * (0.8))\n    end\n    broadcast (HUD - open inventory 2 v)\nend\n\nwhen I receive [hud - open inventory 2 v]\nif <<(costume [number v]) > [3]> and <(costume [number v]) < [14]>> then\n    delete this clone\nelse\n    if <(costume [number v]) > [13]> then\n        go to x: ((-235) + ((inventory slot) * (50))) y: (-170)\n        show\n        go to [front v] layer\n        get item amount\n        print item amount\n    else\n        if <(costume [number v]) = [3]> then\n            go to x: ((-235) + ((equipped inventory slot) * (50))) y: (-170)\n            if <(equipped inventory slot) > [0]> then\n                show\n                go to [front v] layer\n            else\n                hide\n            end\n        else\n            if <(costume [number v]) = [1]> then\n                broadcast (text - clear v)\n                if <(text?) = [0]> then\n                    if <(equipped item) = [0]> then\n                        if <(length of [inventory v]) > [0]> then\n                            set [text? v] to [Click to equip]\n                        else\n                            set [text? v] to []\n                        end\n                    else\n                        set [text? v] to (item (equipped item) of [item names v])\n                    end\n                end\n                broadcast (text - inventory label v)\n            end\n        end\n    end\nend\n\nwhen I receive [start game v]\nset [equipped item v] to [0]\nset [equipped inventory slot v] to [0]\nset [inventory slot v] to [0]\nif <(costume [number v]) = [2]> then\n    show\n    go to [front v] layer\nelse\n    hide\n    if <(costume [number v]) = [1]> then\n        set [item v] to [2]\n        add item (item) (0)\n        forever\n            wait until <key (space v) pressed?>\n            if <<(equipped item) = [5]> and <(underwater?) = [1]>> then\n                set [item v] to [5]\n                remove item (item) (1)\n                wait until <(text?) = [0]>\n                set [item v] to [7]\n                add item (item) (1)\n            end\n            wait until <not <key (space v) pressed?>>\n        end\n    end\nend\n\ndefine get item amount\nif <(costume [number v]) > [13]> then\n    set [counter v] to [0]\n    set [inventory item quantity v] to [0]\n    repeat (length of [inventory v])\n        change [counter v] by (1)\n        if <(item (counter) of [inventory v]) = (inventory item ID)> then\n            change [inventory item quantity v] by (1)\n        end\n    end\n    if <(inventory item ID) = [4]> then\n        set [golden eggs v] to (inventory item quantity)\n    end\n    if <(inventory item quantity) = [0]> then\n        set [item slot v] to (inventory slot)\n        broadcast (inventory slot shift v) and wait\n        delete this clone\n    end\nend\n\ndefine print item amount\nset [counter v] to [0]\nrepeat (length of (inventory item quantity))\n    change [counter v] by (1)\n    switch costume to (join (letter (counter) of (inventory item quantity)) [s])\n    create clone of (_myself_ v)\n    change x by (10)\nend\nchange x by ((0) - ((counter) * (10)))\nswitch costume to (item (inventory item ID) of [item names v])\n\ndefine reset inventory\nif <(costume [number v]) = [1]> then\n    delete (all) of [inventory v]\n    set [counter v] to [0]\n    set [inventory slot v] to [0]\n    repeat (length of [level inventory v])\n        change [counter v] by (1)\n        add item (item (counter) of [level inventory v]) (0)\n    end\n    set [equipped inventory slot v] to [0]\n    set [equipped item v] to [0]\n    broadcast (HUD - close inventory v)\nelse\n    if <(costume [number v]) > [3]> then\n        delete this clone\n    end\nend\n\nwhen I start as a clone\nif <(costume [number v]) = [2]> then\n    go to x: (0) y: (-50)\nelse\n    if <(costume [number v]) = [3]> then\n        hide\n        set [ghost v] effect to (30)\n    else\n        if <(costume [number v]) > [13]> then\n            hide\n        end\n    end\nend\n\nwhen I receive [hud - close inventory v]\nif <(costume [number v]) = [2]> then\n    set y to (-50)\n    go to [front v] layer\nelse\n    if <<(costume [number v]) = [3]> or <(costume [number v]) > [13]>> then\n        hide\n    else\n        if <<(costume [number v]) > [3]> and <(costume [number v]) < [14]>> then\n            delete this clone\n        end\n    end\nend\nbroadcast (text - clear v)\n\nwhen this sprite clicked\nif <(text?) = [0]> then\n    if <(costume [number v]) = [2]> then\n        if <(y position) = [-50]> then\n            broadcast (HUD - open inventory v)\n        else\n            broadcast (HUD - close inventory v)\n        end\n    else\n        if <(costume [number v]) > [13]> then\n            set [equipped item v] to (inventory item ID)\n            set [equipped inventory slot v] to (inventory slot)\n            broadcast (HUD - open inventory 2 v)\n        end\n    end\nend\n\nwhen [i v] key pressed\nif <(text?) = [0]> then\n    if <(costume [number v]) = [2]> then\n        if <(y position) = [-50]> then\n            broadcast (HUD - open inventory v)\n        else\n            broadcast (HUD - close inventory v)\n            set y to (-50)\n        end\n    end\nend\n\ndefine set initial inventory\nif <(costume [number v]) = [1]> then\n    delete (all) of [level inventory v]\n    set [counter v] to [0]\n    repeat (length of [inventory v])\n        change [counter v] by (1)\n        add (item (counter) of [inventory v]) to [level inventory v]\n    end\nend\n\ndefine None\nif <(item) > [0]> then\n    if <not <[inventory v] contains (item)?>> then\n        switch costume to (item (item) of [item names v])\n        set [inventory item id v] to (item)\n        set [inventory item quantity v] to [1]\n        change [inventory slot v] by (1)\n        create clone of (_myself_ v)\n    end\n    add (item) to [inventory v]\n    switch costume to (null v)\n    set [equipped inventory slot v] to (inventory slot)\n    set [equipped item v] to (item)\n    if <(show message?) = [1]> then\n        set [text? v] to (join [Got ] (item (item) of [item names v]))\n        broadcast (HUD - open inventory v)\n    end\nend\n\nwhen I receive [start new level v]\nset initial inventory\n\nwhen I receive [reset level v]\nreset inventory\n\nwhen I receive [add item v]\nif <(costume [number v]) = [1]> then\n    add item (item) (1)\nend\n\nwhen I receive [remove item v]\nif <(costume [number v]) = [1]> then\n    remove item (item) (1)\nend\n\nwhen I receive [inventory slot shift v]\nif <<<(costume [number v]) > [13]> and <(inventory slot) > (item slot)>> or <(costume [number v]) = [1]>> then\n    change [inventory slot v] by (-1)\nend\n\ndefine None\nif <(item) > [0]> then\n    set [counter v] to [0]\n    repeat until <<(item (counter) of [inventory v]) = (item)> or <(counter) = ((length of [inventory v]) + (1))>>\n        change [counter v] by (1)\n    end\n    delete (counter) of [inventory v]\n    repeat until <<(item (counter) of [inventory v]) = (item)> or <(counter) = ((length of [inventory v]) + (1))>>\n        change [counter v] by (1)\n    end\n    if <(counter) = ((length of [inventory v]) + (1))> then\n        set [equipped inventory slot v] to [0]\n        set [equipped item v] to [0]\n    end\n    switch costume to (null v)\n    if <(show message?) = [1]> then\n        set [text? v] to (join [Used ] (item (item) of [item names v]))\n        broadcast (HUD - open inventory v)\n    end\nend\n\n@HUD\n\nwhen I receive [hud - space v]\nif <(costume [number v]) = [3]> then\n    show\n    go to [front v] layer\n    go to (player v)\n    wait (0.1) seconds\n    hide\nend\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nhide\nset size to (100) %\nswitch costume to (health3 v)\ncreate clone of (_myself_ v)\nswitch costume to (air1 v)\ncreate clone of (_myself_ v)\nswitch costume to (space v)\ncreate clone of (_myself_ v)\nswitch costume to (lanternglow v)\ncreate clone of (_myself_ v)\nswitch costume to (edit mode v)\ncreate clone of (_myself_ v)\ngo to x: (0) y: (-130)\nset rotation style [don't rotate v]\npoint in direction (0)\nset [ghost v] effect to (0)\nswitch costume to (start v)\nshow\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to (120) %\n    else\n        set size to (100) %\n    end\nend\n\nwhen this sprite clicked\nif <(costume [number v]) = [1]> then\n    stop [other scripts in sprite v]\n    broadcast (cutscene - intro v)\n    hide\nelse\n    if <(costume [number v]) = [18]> then\n        switch backdrop to (woods v)\n        broadcast (reset level v)\n        hide\n        switch costume to (start v)\n    end\nend\n\nwhen I receive [hud - air v]\nif <<(costume [number v]) > [7]> and <(costume [number v]) < [17]>> then\n    show\n    go to [front v] layer\n    set [timer v] to [0]\n    set [player air v] to [8]\n    if <(underwater?) = [1]> then\n        repeat until <(underwater?) = [0]>\n            go to x: ([x position v] of [player v]) y: (([y position v] of [player v]) + (50))\n            if <(edit mode?) = [0]> then\n                set [timer v] to (((timer) + (1)) mod (61))\n                if <(timer) = [60]> then\n                    change [player air v] by (-1)\n                end\n                if <((timer) mod (pick random (30) to (100))) = [0]> then\n                    broadcast (effect - bubbles v)\n                end\n                switch costume to ((16) - (player air))\n                if <(player air) < [1]> then\n                    hide\n                    broadcast (hurt v)\n                    set [player air v] to [8]\n                    set [underwater? v] to [0]\n                    stop [this script v]\n                end\n            end\n        end\n        hide\n    else\n        hide\n    end\nend\n\nwhen I receive [hud - lantern v]\nif <(costume [number v]) = [17]> then\n    set [lantern? v] to [1]\n    if <(lantern?) = [1]> then\n        broadcast (HUD - health v)\n        broadcast (HUD - close inventory v)\n        switch costume to (air1 v)\n        set size to (100) %\n        switch costume to (lanternglow v)\n        show\n        go to [front v] layer\n        go [backward v] (3) layers\n        repeat until <(lantern?) = [0]>\n            go to x: ([x position v] of [player v]) y: ([y position v] of [player v])\n            if <(edit mode?) = [1]> then\n                hide\n            else\n                show\n            end\n        end\n        hide\n    end\nend\n\nwhen I receive [hud - health v]\nif <<(costume [number v]) > [3]> and <(costume [number v]) < [8]>> then\n    go to [front v] layer\n    switch costume to (join [health] (player health))\nend\n\nwhen I receive [start game v]\nif <(costume [number v]) = [7]> then\n    show\n    go to [front v] layer\nend\n\nwhen I receive [hud - edit mode v]\nif <(costume [number v]) = [2]> then\n    if <(edit mode?) = [1]> then\n        show\n        go to [front v] layer\n        go to x: (0) y: (0)\n    else\n        hide\n    end\nend\n\nwhen I receive [text - game finish v]\nif <(costume [number v]) = [1]> then\n    switch costume to (resume v)\n    set x to (85)\n    show\n    go to [front v] layer\n    repeat until <not <(backdrop [name v]) = [black]>>\n        if <touching (mouse-pointer v)?> then\n            set size to (120) %\n        else\n            set size to (100) %\n        end\n    end\nend\n\nwhen I receive [reset level v]\nif <(costume [number v]) = [7]> then\n    show\n    go to [front v] layer\nend\n\nwhen I receive [cutscene - game finish v]\nhide\n\n@cutscenes\n\nwhen flag clicked\nswitch costume to (transition v)\nset size to (100) %\nset [ghost v] effect to (0)\nhide\ngo to x: (0) y: (0)\nset [layer # v] to [0]\n\ndefine None\nrepeat ([abs v] of ((100) / (speed)) )\n    go to [front v] layer\n    change [ghost v] effect by (speed)\nend\n\nwhen I receive [cutscene - intro v]\nswitch costume to (intro1 v)\nset size to (100) %\nset [ghost v] effect to (100)\nshow\ngo to [front v] layer\neffect - fade (-2)\nswitch backdrop to (black v)\nwait (1) seconds\neffect - fade (2)\nset [layer # v] to [0]\nrepeat (3)\n    change [layer # v] by (1)\n    next costume\n    create clone of (_myself_ v)\nend\nset [text? v] to [In a wood far, far away...]\nbroadcast (text - dialogue v)\nwait (4) seconds\nswitch costume to (intro2 v)\neffect - fade (-2)\nbroadcast (text - clear v) and wait\nset [text? v] to [Two siblings set out from\nhome...]\nbroadcast (text - dialogue v)\nrepeat (4)\n    next costume\n    wait (0.5) seconds\nend\nwait (1) seconds\neffect - fade (5)\nwait (2) seconds\nbroadcast (text - clear v)\nswitch costume to (transition v)\nset [ghost v] effect to (0)\nbroadcast (start game v)\neffect - fade (5)\n\nwhen I receive [cutscene - next level v]\nswitch costume to (transition v)\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\neffect - fade (-5)\nchange [level v] by (1)\nbroadcast (start new level v) and wait\neffect - fade (5)\n\nwhen I start as a clone\nif <(layer #) = [0]> then\n    show\n    go to [front v] layer\n    set [ghost v] effect to (0)\nelse\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\n    set size to (110) %\n    repeat (50)\n        change [ghost v] effect by (-4)\n        change size by ((layer #) * (-0.05))\n    end\n    repeat (50)\n        change size by ((layer #) * (-0.05))\n    end\n    repeat (50)\n        change [ghost v] effect by (4)\n        change size by ((layer #) * (-0.05))\n    end\n    delete this clone\nend\n\nwhen I receive [dialogue1 v]\nset [text? v] to [...?\tWhere's my sister?]\nbroadcast (text - dialogue v)\n\nwhen I receive [cutscene - game finish v]\nswitch costume to (transition v)\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\neffect - fade (-2)\nswitch backdrop to (black v)\nbroadcast (end game v)\nset [layer # v] to [0]\ncreate clone of (_myself_ v)\ngo to [front v] layer\nif <(player health) > [0]> then\n    set [text? v] to [Your sister waves at you as\nyou approach.]\n    broadcast (text - cutscene v) and wait\n    wait (3) seconds\n    set [text? v] to ["Where were you? I've been\nlooking everywhere!" You ask.]\n    broadcast (text - cutscene v) and wait\n    wait (3) seconds\n    set [text? v] to ["I found something interesting,\nbrother," she says.]\n    broadcast (text - cutscene v) and wait\n    wait (3) seconds\n    set [text? v] to [She points up ahead, and you\nboth turn to look...]\n    broadcast (text - cutscene v) and wait\n    wait (3) seconds\n    switch costume to (win v)\nelse\n    set [text? v] to [You succumbed to the forest...]\n    broadcast (text - cutscene v) and wait\n    wait (2) seconds\n    switch costume to (lose v)\nend\nset [ghost v] effect to (100)\neffect - fade (-5)\nset [text? v] to (join (join [Golden Eggs: ] (join (golden eggs) [ of 12])) [\nThanks for playing!])\nbroadcast (text - game finish v)\n\nwhen I receive [reset level v]\nhide\ndelete this clone\n\n@editor\n\nwhen flag clicked\nset [old camera x v] to [0]\nset [old camera y v] to [0]\nset [flying? v] to [0]\ngo to x: (0) y: (0)\nhide\nswitch costume to (costume1 v)\nshow list [item names v]\nshow list [objects v]\n\nwhen I receive [hud - edit mode v]\nif <(edit mode?) = [1]> then\n    set [old camera x v] to (camera x)\n    set [old camera y v] to (camera y)\n    show\n    go to [front v] layer\n    forever\n        go to (mouse-pointer v)\n        if <<touching (objects v)?> or <touching (solid objects v)?>> then\n            say [Press 'X' to delete this object]\n        else\n            say []\n        end\n        scroll (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\nelse\n    set [camera x v] to (old camera x)\n    set [camera y v] to (old camera y)\n    hide\nend\n\ndefine enter object data\nhide list [item names v]\nhide list [objects v]\nadd (join ((level) + (10)) (join ((round ((camera x) + (x position))) + (2000)) ((round ((camera y) + (y position))) + (2000)))) to [objects v]\nask [Enter a costume ID for the object \(leave blank to skip\):] and wait\nget input (answer) (100) (10)\nask [If this object is animated, enter the number of frames in the animation \(make sure they're in consecutive order\). Leave blank to skip:] and wait\nget input (answer) (50) (10)\nask [Enter an object behavior ID: \[0\]decor \[1\]dialogue \[2\]bouncy \[3\]ladder \[4\]stationary_danger \[5\]sliding_danger \[6\]falling_danger \[7\]water \[8\]item \[9\]mobile_danger \[10\]container \[11\]slime \[12\]dropdown_platform \[13\]door \[14\]event_trigger] and wait\nget input (answer) (15) (10)\nif <(answer) = [8]> then\n    ask [Enter an item ID: \(see list for ID numbers\)] and wait\n    get input (answer) (length of [item names v]) (10)\n    replace item (last) of [objects v] with (join (item (last) of [objects v]) [10101010])\nelse\n    replace item (last) of [objects v] with (join (item (last) of [objects v]) [10])\n    if <<(answer) = [10]> or <(answer) = [13]>> then\n        ask [This object has a "key" item associated with it. Enter the ID# of the item, or enter 0 to skip:] and wait\n        get input (answer) (length of [item names v]) (10)\n        ask [This object also has a "reward" item associated with it. Enter the constume# of the item, or enter 0 to skip:] and wait\n        get input (answer) (length of [item names v]) (10)\n        ask [This object can change costumes after being triggered \(make sure they're in consecutive order\). Enter the final costume#, or enter 0 to skip:] and wait\n        get input (answer) (100) (10)\n        ask [This object can change its behavior after being triggered. Enter the new behavior ID, or enter 0 to skip:] and wait\n        get input (answer) (16) (10)\n    else\n        replace item (last) of [objects v] with (join (item (last) of [objects v]) [10101010])\n    end\n    ask [If you want this object to have dialogue associated with it, enter the text: \(leave blank to skip\)] and wait\n    replace item (last) of [objects v] with (join (item (last) of [objects v]) (answer))\nend\nshow list [item names v]\nshow list [objects v]\nset [object index v] to (length of [objects v])\nbroadcast (spawn object \(editor\) v) and wait\n\ndefine None\nif <<(input) > [0]> and <(input) < ((input range) + (1))>> then\n    replace item (last) of [objects v] with (join (item (last) of [objects v]) ((input) + (offset)))\nelse\n    replace item (last) of [objects v] with (join (item (last) of [objects v]) (offset))\nend\n\ndefine None\nif <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n    change [camera x v] by ((speed) * ((<key (left arrow v) pressed?> * (-1)) + <key (right arrow v) pressed?>))\n    if <<(camera x) < [0]> or <(camera x) > ((480) * ((item (level) of [level lengths v]) - (1)))>> then\n        change [camera x v] by ((0) - ((speed) * ((<key (left arrow v) pressed?> * (-1)) + <key (right arrow v) pressed?>)))\n    end\nend\nif <<key (up arrow v) pressed?> or <key (down arrow v) pressed?>> then\n    change [camera y v] by ((speed) * ((<key (down arrow v) pressed?> * (-1)) + <key (up arrow v) pressed?>))\n    if <<(camera y) < [-1000]> or <(camera y) > [1000]>> then\n        change [camera y v] by ((0) - ((speed) * ((<key (down arrow v) pressed?> * (-1)) + <key (up arrow v) pressed?>)))\n    end\nend\nbroadcast (tick v)\n\nwhen I receive [fly v]\nrepeat until <(flying?) = [0]>\n    set [time midair v] to [0]\nend\n\nwhen [z v] key pressed\nif <(backdrop [number v]) > [1]> then\n    ask [Enter a command \(skip / health / give / fly / superjump:] and wait\n    if <(answer) = [skip]> then\n        ask [skip to level:] and wait\n        if <<(answer) > [0]> and <(answer) < ((length of [level lengths v]) + (1))>> then\n            set [level v] to (answer)\n            broadcast (start new level v)\n            ask (join (join [Skipped to level ] (level)) [. Press Enter to finish]) and wait\n        else\n            ask [Invalid level. Press Enter to finish] and wait\n        end\n    else\n        if <(answer) = [health]> then\n            ask [set health to:] and wait\n            if <((answer) + (0)) = (answer)> then\n                set [player health v] to (answer)\n                broadcast (HUD - health v)\n                ask (join (join [Health set to ] (player health)) [. Press Enter to finish]) and wait\n            else\n                ask [Invalid input. Press Enter to finish] and wait\n            end\n        else\n            if <(answer) = [give]> then\n                ask [give item#:] and wait\n                if <<(answer) > [0]> and <(answer) < ((length of [item names v]) + (1))>> then\n                    set [item v] to (answer)\n                    broadcast (add item v)\n                    ask (join (join [Obtained item ] (answer)) [. Press Enter to finish]) and wait\n                else\n                    ask [Invalid input. Press Enter to finish] and wait\n                end\n            else\n                if <(answer) = [superjump]> then\n                    set [jump power v] to (((JUMP POWER) mod (24)) + (12))\n                    ask (join (join [Superjump set to ] <(JUMP POWER) = [24]>) [. Press Enter to finish]) and wait\n                else\n                    if <(answer) = [fly]> then\n                        set [flying? v] to ((1) - (flying?))\n                        broadcast (fly v)\n                        ask (join (join [Flying set to ] <[1] = (flying?)>) [. Press Enter to finish]) and wait\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]) > [2]> then\n    set [edit mode? v] to ((1) - (edit mode?))\n    broadcast (HUD - edit mode v)\nend\n\nwhen [r v] key pressed\nif <(backdrop [number v]) > [2]> then\n    broadcast (reset level v)\nend\n\n@solid objects\n\nwhen flag clicked\nhide\nset [ghost v] effect to (0)\nswitch costume to (null v)\n\nwhen I receive [spawn solid objects v]\nif <(costume [number v]) = [1]> then\n    spawn solid objects\nend\n\ndefine create solid object\nset [solid obj. list index v] to (solid obj. index)\nset [solid obj. linked master list index v] to (item (item (solid obj. list index) of [solid objects v]) of [objects v])\nset [solid obj. xpos v] to ((join (join (join (letter (3) of (solid obj. linked master list index)) (letter (4) of (solid obj. linked master list index))) (letter (5) of (solid obj. linked master list index))) (letter (6) of (solid obj. linked master list index))) - (2000))\nset [solid obj. ypos v] to ((join (join (join (letter (7) of (solid obj. linked master list index)) (letter (8) of (solid obj. linked master list index))) (letter (9) of (solid obj. linked master list index))) (letter (10) of (solid obj. linked master list index))) - (2000))\nset [solid obj. costume id v] to ((join (letter (11) of (solid obj. linked master list index)) (letter (12) of (solid obj. linked master list index))) - (10))\nset [solid obj. behavior id v] to ((join (letter (15) of (solid obj. linked master list index)) (letter (16) of (solid obj. linked master list index))) - (10))\nset [solid obj. linked master list index v] to (item (solid obj. list index) of [solid objects v])\ncreate clone of (_myself_ v)\n\nwhen I receive [start new level v]\ndelete this clone\n\nwhen I receive [start game v]\ndelete this clone\n\nwhen I receive [reset level v]\ndelete this clone\n\nwhen I receive [spawn object \(editor\) v]\nif <(costume [number v]) = [1]> then\n    wait (1) seconds\n    set [solid obj. index v] to (length of [solid objects v])\n    create solid object\nend\n\nwhen I receive [hud - edit mode v]\nif <(costume [number v]) > [1]> then\n    if <(edit mode?) = [1]> then\n        show\n        set [ghost v] effect to (70)\n    else\n        set [ghost v] effect to (100)\n    end\nend\n\nwhen I start as a clone\nswitch costume to (join [s] (solid obj. costume ID))\nshow\ngo to [front v] layer\nif <(edit mode?) = [0]> then\n    set [ghost v] effect to (100)\nelse\n    set [ghost v] effect to (70)\nend\nforever\n    go to x: ((solid obj. xpos) - (camera x)) y: ((solid obj. ypos) - (camera y))\n    if <<(round (x position)) = (round ((solid obj. xpos) - (camera x)))> and <(round (y position)) = (round ((solid obj. ypos) - (camera y)))>> then\n        show\n        if <(edit mode?) = [0]> then\n            behavior\n        end\n    else\n        hide\n    end\nend\n\nwhen I receive [end game v]\ndelete this clone\n\ndefine behavior\nif <(solid obj. behavior ID) = [12]> then\n    dropdown platform\nelse\nend\n\nwhen I receive [delete object v]\nif <(solid obj. linked master list index) > (object index)> then\n    change [solid obj. linked master list index v] by (-1)\n    change [solid obj. list index v] by (-1)\nelse\n    if <(solid obj. linked master list index) = (object index)> then\n        delete (solid obj. list index) of [solid objects v]\n        delete this clone\n    end\nend\n\nwhen I receive [opened door v]\nif <(solid obj. linked master list index) > (object index)> then\n    change [solid obj. list index v] by (-1)\nelse\n    if <(solid obj. linked master list index) = (object index)> then\n        delete this clone\n    end\nend\n\ndefine dropdown platform\nif <((player ypos) - (27)) < (solid obj. ypos)> then\n    hide\nelse\n    show\n    if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n        hide\n    end\nend\n\ndefine spawn solid objects\nset [solid obj. index v] to [0]\nrepeat (length of [solid objects v])\n    change [solid obj. index v] by (1)\n    create solid object\nend\n\n@font: Macondo Swash Caps\n\nwhen flag clicked\nhide\nswitch costume to (background v)\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 (background v)\nset size to (size) %\nset [counter v] to [0]\ngo to x: (x pos) y: (y pos)\nrepeat (length of (text))\n    switch costume to (null v)\n    change [counter v] by (1)\n    if <(letter (counter) of (text)) = [\]> then\n        if <(letter ((counter) + (1)) of (text)) = [t]> then\n            wait (0.5) seconds\n            wait until <key (space v) pressed?>\n            broadcast (text - clear2 v) and wait\n            go to x: (x pos) y: (y pos)\n        else\n            if <(letter ((counter) + (1)) of (text)) = [n]> then\n                set x to (x pos)\n                change y by ((size) / (-4))\n            end\n        end\n        change [counter v] by (1)\n    else\n        switch costume to (letter (counter) of (text))\n        if <<(costume [number v]) = [95]> or <(costume [number v]) = [96]>> then\n            switch costume to (join (letter (counter) of (text)) [s])\n        end\n        if <<<(costume [number v]) = [1]> and <(letter (counter) of (text)) = [1]>> or <(costume [number v]) = [96]>> then\n            switch costume to (null v)\n        end\n        create clone of (_myself_ v)\n        change x by (((item (costume [number v]) of [font sizes v]) + (1)) * ((size) / (90)))\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 (background v)\nif <(dialogue?) = [1]> then\n    wait until <<key (space v) pressed?> or <(text?) = [0]>>\n    set [text? v] to [0]\n    broadcast (text - clear v)\nend\n\nwhen I receive [text - inventory label v]\nprint (text?) (55) (-160) (75) (230) (0)\nset [text? v] to [0]\n\nwhen I receive [hud - edit mode v]\nset [text? v] to [0]\ndelete this clone\n\nwhen I receive [reset level v]\ndelete this clone\n\nwhen I receive [start new level v]\ndelete this clone\n\nwhen I receive [text - dialogue v]\nprint (text?) (-184) (-125) (100) (184) (1)\n\nwhen I receive [text - clear2 v]\nif <not <(costume [number v]) = [96]>> then\n    delete this clone\nend\n\ndefine font size parser\nset [text? v] to [06.12.11.12.10.12.11.11.11.14.15.11.15.12.12.12.15.13.11.08.12.11.21.13.17.12.17.12.12.14.15.15.21.12.13.15.10.11.09.12.09.11.12.11.03.04.11.03.17.11.11.12.12.08.09.08.11.11.17.10.11.09.10.05.11.06.06.07.18.13.17.09.15.17.03.08.08.02.03.06.09.09.09.06.06.12.03.03.03.03.12.08.10.09.10.]\nset [counter v] to [0]\ndelete (all) of [font sizes v]\nrepeat ((length of (text?)) / (3))\n    change [counter v] by (3)\n    add (join (letter ((counter) - (2)) of (text?)) (letter ((counter) - (1)) of (text?))) to [font sizes v]\nend\nset [text? v] to [0]\n\nwhen I start as a clone\ngo to [front v] layer\n\nwhen I receive [text - clear v]\nhide\ndelete this clone\n\nset [text? v] to [1]\nprint [A twisty-looking beanstalk.] (-184) (0) (90) (184) (1)\n\nwhen I receive [text - game finish v]\nprint (text?) (-205) (-130) (75) (230) (0)\n\ndefine delete clone\ndelete this clone\n\nwhen I receive [text - cutscene v]\nprint (text?) (-184) (0) (100) (184) (0)\n\n@effects\n\nwhen flag clicked\nhide\nset rotation style [all around v]\ngo to x: (0) y: (0)\nswitch costume to (leaf v)\nset [ghost v] effect to (0)\nset size to (100) %\nset [effect id v] to [0]\nrepeat until <not <(backdrop [name v]) = [title]>>\n    particle spawner (0) (0) [leaf] (4)\n    wait (0.5) seconds\nend\n\ndefine None\nif <(effect ID) = [0]> then\n    set [effect id v] to (id)\n    set [xpos v] to (x)\n    set [ypos v] to (y)\n    switch costume to (costume)\n    create clone of (_myself_ v)\n    set [effect id v] to [0]\nend\n\nwhen I start as a clone\nif <(effect ID) = [1]> then\n    set [ghost v] effect to (0)\n    set size to (10) %\n    show\n    go to [front v] layer\n    repeat until <(size) > [150]>\n        set size to ((size) * (1.2)) %\n        set [ghost v] effect to ((size) / (1.5))\n        scroll\n    end\nelse\n    if <(effect ID) = [2]> then\n        set rotation style [don't rotate v]\n        set size to (pick random (25) to (75)) %\n        point in direction (pick random (-30) to (30))\n        show\n        go to [front v] layer\n        repeat until <<touching (_edge_ v)?> or <<touching (level hitbox v)?> or <touching (objects v)?>>>\n            turn right (pick random (0) to (3)) degrees\n            change [xpos v] by ([cos v] of (direction) )\n            change [ypos v] by (3)\n            scroll\n        end\n    else\n        if <(effect ID) = [3]> then\n            change [xpos v] by (pick random (-75) to (75))\n            change [ypos v] by (pick random (30) to (100))\n            set size to (pick random (75) to (150)) %\n            set [ghost v] effect to (100)\n            show\n            go to [front v] layer\n            repeat (50)\n                change [ghost v] effect by (-2)\n                change [ypos v] by (1)\n                scroll\n            end\n            repeat (40)\n                change [ypos v] by (1)\n                scroll\n            end\n            repeat (50)\n                change [ghost v] effect by (2)\n                change [ypos v] by (1)\n                scroll\n            end\n        else\n            if <(effect ID) = [4]> then\n                go to x: (-240) y: (pick random (-70) to (180))\n                set size to (pick random (20) to (80)) %\n                point in direction (pick random (60) to (120))\n                show\n                glide (pick random (2) to (3)) secs to x: (240) y: (pick random (-180) to (70))\n                delete this clone\n            else\n            end\n        end\n    end\nend\ndelete this clone\n\nwhen I receive [effect - death v]\nparticle spawner (player xpos) (player ypos) [death] (1)\n\nwhen I receive [effect - slime v]\nparticle spawner (effect xpos) (effect ypos) [slime] (1)\n\nwhen I receive [effect - bubbles v]\nparticle spawner (player xpos) ((player ypos) + (10)) [bubbles] (2)\n\nwhen I receive [effect - magic v]\nparticle spawner (effect xpos) (effect ypos) [magic] (3)\n\ndefine scroll\ngo to x: (round ((xpos) - (camera x))) y: (round ((ypos) - (camera y)))\nif <<(round (x position)) = (round ((xpos) - (camera x)))> and <(round (y position)) = (round ((ypos) - (camera y)))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [start game v]\ndelete this clone\n\nwhen I receive [end game v]\ndelete this clone\n\nwhen I receive [reset level v]\ndelete this clone\n\nwhen I receive [start new level v]\ndelete this clone\n\nwhen I receive [effects - shards v]\nbroadcast (sound - rock shards v)\nparticle spawner (effect xpos) (effect ypos) [shards] (1)\n\n@sound\n\nwhen flag clicked\ngo to x: (210) y: (157)\nswitch costume to (unmute v)\nset volume to (100) %\nhide\nset [timer v] to [0]\nforever\n    play sound [Isle of Songs v] until done\nend\n\nwhen I receive [cutscene - intro v]\nrepeat (100)\n    change volume by (-1)\nend\nstop [other scripts in sprite v]\nstop all sounds\n\nwhen I receive [start game v]\nshow\ngo to [front v] layer\nrepeat (50)\n    change volume by (2)\nend\n\nwhen I receive [sound - splash v]\nstart sound [plunge v]\n\nwhen I receive [opened door v]\nstart sound [get_item v]\n\nwhen I receive [add item v]\nstart sound [get_item v]\n\nwhen I receive [sound - bubbling v]\nrepeat until <(underwater?) = [0]>\n    play sound [bubbles v] until done\nend\n\nwhen I receive [hurt v]\nstart sound [rattle v]\n\nwhen I receive [sound - boing v]\nstart sound [boing v]\n\nwhen I receive [sound - jump v]\nstart sound [water drop v]\n\nwhen I receive [start game v]\nset [current music v] to [Lost Woods]\nforever\n    play sound (current music) until done\nend\n\nwhen this sprite clicked\nnext costume\nset volume to (((costume [number v]) - (1)) * (100)) %\n\nwhen I receive [start new level v]\nrepeat (50)\n    change volume by (-2)\nend\nset [current music v] to (item (level) of [level music v])\nstop all sounds\nrepeat (50)\n    change volume by (2)\nend\n\nwhen I receive [start game v]\nforever\n    if <<<not <(round (player xvel)) = [0]>> or <<not <(round (player yvel)) = [0]>> and <(climbing?) = [1]>>> and <<(underwater?) = [0]> and <(text?) = [0]>>> then\n        play sound [walk_sound v] until done\n    end\nend\n\nwhen I receive [sound - rock shards v]\nstart sound [rock drop v]\n\nwhen I receive [hud - lantern v]\nwait (0.2) seconds\nshow\ngo to [front v] layer\n\n@assets\n\nwhen flag clicked\nhide\n\n@logo2\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset rotation style [all around v]\npoint in direction (90)\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 (3) seconds\nrender (-270) (5) (0)\nwait (2) seconds\nbroadcast (end logo v)\n\ndefine None\nset [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 [ghost v] effect to (100)\n        show\n        go to [front v] layer\n        repeat ((clone#) * (10))\n            turn right (3) degrees\n        end\n        repeat (50)\n            change [ghost v] effect by (-2)\n            turn right (3) degrees\n        end\n        forever\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\nwhen I receive [end logo v]\nrepeat (50)\n    change [ghost v] effect by (2)\nend\ndelete this clone\n\n
If you have questions in the comments, they will be answered on my new account @TSwanyIRL.\n\nArrow keys to move. The grey circle is your cursor.\nStuck on a tricky level? Stuck in a wall? Drawing didn't clear? Press R to restart!\nCoins are to the left of the shop button. Level number is to the right of the shop button.\n---\n\nNOTE - 06.03.2018\nThe 2 year anniversary of ABTP is almost here! I recreated the three bitmap character sprites and made them vector just like Red and The Blues! (I personally think I did a really good job on the Bubbles sprite)\nI also added different music tracks for the different dimensions! Sadly I don't think I'll be going to scratch camp this year, but I'm still going to add more levels and other new features! \n\nNOTE - 08.18.2020\nHas it really been over four years? It has! New levels out now. The conclusion is coming soon! \n\nNOTE - 02.03.2023\n\n... some day, folks. some day.