Skyward v1.1 (scrolling platformer) #games #all 

Instructions:                            ----EXPLANATION---\nThis game is meant to be played, but it's also meant to be customized by you. You can edit levels, and also make your own. If you want your own levels to save after exiting the page, you will have to remix the project.\n\n                              ---CONTROLS---\n     -In play mode:\nUse arrow keys to move. \nPress space to walk, otherwise you'll run everywhere\nYou can double jump and wall jump.\nPress down arrow when in a portal to go to the next level\n\n-In edit mode:\n\nPress E to toggle edit mode\nUse WASD to move around (you can fly)\nUse left and right arrow keys to change what block you have selected\nTo add a hitbox/collision to the level, press See inside, and go into the level hitbox sprite. Edit the costume to add a hitbox.\nPress O to save your changes (unless you remix, reloading the page will reset changes)

@Stage\n\nwhen flag clicked\nset volume to (75) %\nforever\n    if <not <(LEVEL #) = [3]>> then\n        play sound [a cute date - elijah who v] until done\n    end\n    if <not <(LEVEL #) = [3]>> then\n        play sound [Cut My Hair \(Mounika Remix\) - Cavetown v] until done\n    end\nend\n\nbroadcast (tick v)\n\nwhen flag clicked\nforever\n    if <(LEVEL #) = [3]> then\n        stop all sounds\n        forever\n            play sound [All star - 8bit remix.mp3 v] until done\n        end\n    end\nend\n\n@Player\n\ndefine change y\nchange [y v] by (Yvel)\ngoto\nif <(Yvel) > [0]> then\n    repeat until <not <touching (level hitbox v)?>>\n        change [y v] by (-1)\n        set [yvel v] to [0]\n        goto\n    end\nelse\n    repeat until <<<not <touching (level hitbox v)?>> and <not <touching (bridge hitbox v)?>>> or <<<(!MODE) = [slide]> and <([abs v] of (Xvel) ) < [3]>> and <touching (bridge hitbox v)?>>>\n        change [y v] by (1)\n        set [yvel v] to [0]\n        goto\n    end\nend\n\ndefine change x | speed (speed)\nif <<<(time on wall) > [13]> or <(time on wall) = [0]>> or <<not <<(time on wall) > [13]> or <(time on wall) = [0]>>> and <(touching ground) = [true]>>> then\n    change [x v] by ((round (Xvel)) * (speed))\n    goto\n    if <touching (level hitbox v)?> then\n        change [x v] by ((round (Xvel)) * ((speed) * (-1)))\n        set [xvel v] to ((Xvel) * (0.4))\n        goto\n    end\nend\nif <(Yvel) < [3]> then\n    set [touching wall v] to [false]\n    change x by (-3)\n    if <touching (level hitbox v)?> then\n        set [touching wall v] to [true]\n        set [double jumpable v] to [false]\n        set [yvel v] to ((Yvel) * (0.75))\n        change [time on wall v] by (1)\n        set [!mode v] to [wall]\n        set [animate v] to [1]\n        if <<(time on wall) < [13]> and <(touching ground) = [false]>> then\n            set [xvel v] to [-1]\n        end\n        if <<key (up arrow v) pressed?> and <(touching ground) = [false]>> then\n            start sound [Jump2 v]\n            set [xvel v] to [12]\n            set [yvel v] to [20]\n            set [double jumpable v] to [false]\n            set [time on wall v] to [0]\n            set [!mode v] to [jump]\n            broadcast (jump pressed v)\n        end\n    end\n    change x by (6)\n    if <touching (level hitbox v)?> then\n        set [touching wall v] to [true]\n        set [double jumpable v] to [false]\n        set [yvel v] to ((Yvel) * (0.6))\n        change [time on wall v] by (1)\n        set [!mode v] to [wall]\n        set [animate v] to [1]\n        if <<(time on wall) < [13]> and <(touching ground) = [false]>> then\n            set [xvel v] to [1]\n        end\n        if <<key (up arrow v) pressed?> and <(touching ground) = [false]>> then\n            start sound [Jump2 v]\n            set [xvel v] to [-12]\n            set [yvel v] to [15]\n            set [double jumpable v] to [false]\n            set [time on wall v] to [0]\n            set [!mode v] to [jump]\n            broadcast (jump pressed v)\n        end\n    end\n    change x by (-3)\n    if <(touching wall) = [false]> then\n        set [time on wall v] to [0]\n    end\nend\n\ndefine goto\ngo to x: ((round (x)) - (round (cam X))) y: ((round (y)) - (round (cam Y)))\n\ndefine Reset\nclear graphic effects\nshow\nset size to (80) %\ngo to x: (0) y: (0)\nset [xvel v] to [0]\nset [yvel v] to [0]\nif <(LEVEL #) = [1]> then\n    set [x v] to [112]\n    set [y v] to [363]\nelse\n    set [x v] to [132]\n    set [y v] to [363]\nend\nset [cam x v] to [112]\nset [cam y v] to [364]\nset [!mode v] to [idle]\n\nwhen flag clicked\nshow\nset [level # v] to [1]\nset [held jump v] to [no]\nset rotation style [left-right v]\npoint in direction (90)\nReset\ngo to [front v] layer\ngo [backward v] (1) layers\nwait (0.01) seconds\nforever\n    if <<touching color (#a0b4ca)?> or <<<[3000] < (y)> or <(y) < [-40]>> and <(timer) > [1]>>> then\n        broadcast (die v)\n        Reset\n    end\n    if <<touching color (#1b47b0)?> and <key (down arrow v) pressed?>> then\n        broadcast (next level v)\n        repeat (20)\n            change size by (-4)\n            change [ghost v] effect by (5)\n        end\n        change [level # v] by (1)\n        broadcast (LEVEL - Load v)\n        hide\n        Reset\n    end\n    broadcast (Play v)\nend\n\nwhen I receive [play v]\nif <(!MODE) = [edit]> then\n    change [x v] by (Xvel)\n    change [y v] by (Yvel)\n    if <key (d v) pressed?> then\n        change [xvel v] by (3)\n    end\n    if <key (a v) pressed?> then\n        change [xvel v] by (-3)\n    end\n    if <key (w v) pressed?> then\n        change [yvel v] by (3)\n    end\n    if <key (s v) pressed?> then\n        change [yvel v] by (-3)\n    end\n    set [xvel v] to ((Xvel) * (0.8))\n    set [yvel v] to ((Yvel) * (0.8))\n    goto\n    move cam\nelse\n    if <(!MODE) = [slide]> then\n        switch costume to (crouch hitbox v)\n    else\n        switch costume to (hitbox v)\n    end\n    goto\n    change y by (-1)\n    if <<touching (level hitbox v)?> or <touching (bridge hitbox v)?>> then\n        set [touching ground v] to [true]\n        if <<<key (up arrow v) pressed?> and <(held jump) = [no]>> and <not <(!MODE) = [slide]>>> then\n            broadcast (jump pressed v)\n            start sound [Jump v]\n            set [yvel v] to [18]\n            set [!mode v] to [jump]\n            set [touching ground v] to [false]\n        end\n    else\n        set [touching ground v] to [false]\n    end\n    change y by (1)\n    if <(touching ground) = [true]> then\n        if <(!MODE) = [slide]> then\n            particles (pick random (-5) to (([abs v] of (Xvel) ) * (2)))\n            if <key (right arrow v) pressed?> then\n                change [xvel v] by (0.05)\n            end\n            if <key (left arrow v) pressed?> then\n                change [xvel v] by (-0.05)\n            end\n            set [xvel v] to ((Xvel) * (0.95))\n        else\n            if <key (right arrow v) pressed?> then\n                change [xvel v] by (5)\n            end\n            if <key (left arrow v) pressed?> then\n                change [xvel v] by (-5)\n            end\n            set [xvel v] to ((Xvel) * (0.75))\n        end\n    else\n        if <key (right arrow v) pressed?> then\n            change [xvel v] by (0.7)\n        end\n        if <key (left arrow v) pressed?> then\n            change [xvel v] by (-0.7)\n        end\n        set [xvel v] to ((Xvel) * (0.95))\n        if <(!MODE) = [slide]> then\n            set [!mode v] to [idle]\n        end\n    end\n    if <(touching ground) = [true]> then\n        set [double jumpable v] to [false]\n    end\n    if <<key (up arrow v) pressed?> and <<(double jumpable) = [true]> and <(held jump) = [no]>>> then\n        start sound [Flip v]\n        set [yvel v] to [18]\n        set [double jumpable v] to [false]\n        set [!mode v] to [doublejump]\n        particles (pick random (3) to (6))\n    end\n    if <key (space v) pressed?> then\n        change x | speed [0.6]\n    else\n        change x | speed [1]\n    end\n    change [yvel v] by (-1.6)\n    change y\n    if <<(round (Yvel)) = [0]> and <(touching ground) = [true]>> then\n        if <([abs v] of (Xvel) ) < [9]> then\n            set [!mode v] to [walk]\n        else\n            set [!mode v] to [run]\n            if <(pick random (1) to (3)) = [1]> then\n                particles [1]\n            end\n        end\n        if <(round (Xvel)) = [0]> then\n            set [!mode v] to [idle]\n        end\n    end\n    switch costume to (hitbox v)\n    if <<<key (down arrow v) pressed?> and <(touching ground) = [true]>> or <touching (level hitbox v)?>> then\n        set [!mode v] to [slide]\n        start sound [Wall Slide v]\n    end\n    if <(!MODE) = [jump]> then\n        if <([abs v] of (Xvel) ) < [2]> then\n            set [!mode v] to [jump-up]\n        else\n            set [!mode v] to [jump-side]\n        end\n    end\n    if <<(!MODE) = [wall]> and <(touching wall) = [false]>> then\n        set [!mode v] to [jump-up]\n    end\n    if <(!MODE) = [doublejump]> then\n        if <([abs v] of (Xvel) ) < [2]> then\n            set [!mode v] to [jump-up]\n            set [animate v] to [0]\n        else\n            set [!mode v] to [doublejump]\n        end\n    end\n    if <<<(!MODE) = [run]> or <(!MODE) = [walk]>> and <(touching ground) = [false]>> then\n        set [!mode v] to [jump-side]\n    end\n    point in direction (Xvel)\n    animate\n    if <key (r v) pressed?> then\n        Reset\n    end\n    move cam\n    go to [front v] layer\n    go [backward v] (7) layers\nend\n\nwhen I receive [jump pressed v]\nparticles (pick random (3) to (6))\nset [held jump v] to [yes]\nwait until <not <key (up arrow v) pressed?>>\nset [held jump v] to [no]\nif <(touching wall) = [false]> then\n    set [double jumpable v] to [true]\nend\n\ndefine animate\nif <not <(switch) = (!MODE)>> then\n    set [animate v] to [1]\nend\nset [switch v] to (!MODE)\nif <(!MODE) = [idle]> then\n    change [animate v] by (0.3)\n    if <(animate) > [4]> then\n        set [animate v] to [1]\n    end\nend\nif <(!MODE) = [walk]> then\n    change [animate v] by ([abs v] of ((Xvel) / (10)) )\n    if <(round (animate)) > [3]> then\n        set [animate v] to [1]\n    end\nend\nif <(!MODE) = [run]> then\n    change [animate v] by ([abs v] of ((Xvel) / (16)) )\n    if <(round (animate)) > [6]> then\n        set [animate v] to [1]\n    end\nend\nif <(!MODE) = [jump-side]> then\n    change [animate v] by (0.5)\n    if <(round (animate)) > [14]> then\n        set [animate v] to [13]\n    end\nend\nif <(!MODE) = [jump-up]> then\n    change [animate v] by (0.5)\n    if <(round (animate)) > [13]> then\n        set [animate v] to [12]\n    end\nend\nif <(!MODE) = [doublejump]> then\n    change [animate v] by (1)\n    if <(round (animate)) > [20]> then\n        set [animate v] to [19]\n    end\nend\nchange y by (3)\nswitch costume to (join (!MODE) (round (animate)))\n\ndefine move cam\nchange [cam x v] by ((x position) * (0.3))\nif <(!MODE) = [slide]> then\n    change [cam y v] by (((y position) - (20)) * (0.2))\nelse\n    change [cam y v] by ((y position) * (0.3))\nend\nif <(cam X) < [230]> then\n    set [cam x v] to [230]\nend\nif <(cam Y) < [167]> then\n    set [cam y v] to [167]\nend\nif <(cam X) > [3650]> then\n    set [cam x v] to [3650]\nend\n\ndefine particles (amount)\nrepeat (amount)\n    create clone of (particles v)\nend\n\nwhen flag clicked\nforever\n    if <<(!MODE) = [wall]> or <(!MODE) = [slide]>> then\n        play sound [Wall Slide v] until done\n    end\n    if <<(!MODE) = [walk]> or <(!MODE) = [run]>> then\n        play sound [Step v] until done\n    end\nend\n\n@level hitbox\n\nwhen flag clicked\ngo to x: (0) y: (-100)\nset [xvel v] to [0]\nset [yvel v] to [0]\nshow\nswitch costume to (blank v)\nset size to (1600) %\nswitch costume to (level 1 v)\ngo to [front v] layer\nforever\n    if <(!MODE) = [edit]> then\n        set [ghost v] effect to (75)\n    else\n        set [ghost v] effect to (100)\n    end\n    switch costume to ((LEVEL #) + (1))\nend\n\nwhen I receive [play v]\ngo to x: ((round (level x)) - (round (cam X))) y: ((round (level y)) - (round (cam Y)))\n\n@tiles\n\nwhen flag clicked\nbroadcast (LEVEL - Load v) and wait\nbroadcast (clone level tiles v) and wait\nforever\n    broadcast (position tiles v)\nend\n\ndefine setup\nshow\nset [tile index v] to [1]\nset [tile x v] to [16]\nrepeat (clone count x)\n    set [tile y v] to [16]\n    repeat (clone count y)\n        create clone of (_myself_ v)\n        change [tile y v] by (32)\n        change [tile index v] by (1)\n    end\n    change [tile x v] by (32)\n    change [tile index v] by ((grid height) - (clone count y))\nend\nhide\n\nwhen I receive [position tiles v]\nif <([abs v] of ((tile x) - (cam X)) ) > ((clone count x) * (16))> then\n    if <(tile x) < (cam X)> then\n        loop tile x (clone count x)\n    else\n        loop tile x ((0) - (clone count x))\n    end\nend\nif <([abs v] of ((tile y) - (cam Y)) ) > ((clone count y) * (16))> then\n    if <(tile y) < (cam Y)> then\n        loop tile y (clone count y)\n    else\n        loop tile y ((0) - (clone count y))\n    end\nend\nswitch costume to (big v)\ngo to x: ((tile x) - (cam X)) y: ((tile y) - (cam Y))\nset [tile v] to (item (tile index) of [tiles v])\nif <(tile) < [4]> then\n    set [tile v] to [4]\nend\nswitch costume to (costume9 v)\nif <<touching (mouse-pointer v)?> and <(!MODE) = [edit]>> then\n    switch costume to (tile select)\n    set [ghost v] effect to (50)\nelse\n    switch costume to (tile)\n    set [ghost v] effect to (0)\nend\ngo to [front v] layer\ngo [backward v] (((clone count x) * (clone count y)) - (1)) layers\nif <(tile) < [24]> then\n    go [backward v] (4) layers\nend\nif <[32] < (tile)> then\n    go [backward v] (1) layers\nend\n\ndefine loop tile x (tile skip)\nchange [tile x v] by ((tile skip) * (32))\nchange [tile index v] by ((tile skip) * (grid height))\n\ndefine loop tile y (tile skip)\nchange [tile y v] by ((tile skip) * (32))\nchange [tile index v] by (tile skip)\n\nwhen I receive [clone level tiles v]\nset size to (200) %\nset [clone count x v] to [16]\nset [clone count y v] to [13]\nsetup\n\n@generate\n\ndefine generate\ndelete all of [tiles v]\nset [grid width v] to [120]\nset [grid height v] to [90]\nwall column\nrepeat ((grid width) - (2))\n    boxed column\nend\nwall column\n\nwhen I receive [generate level v]\nbroadcast (LEVEL - Load v)\n\ngenerate\n\ndefine wall column\nrepeat (grid height)\n    add [4] to [tiles v]\nend\n\ndefine boxed column\nadd [5] to [tiles v]\nrepeat ((grid height) - (1))\n    add [4] to [tiles v]\nend\n\n@parallax\n\nwhen flag clicked\na\n\nwhen I start as a clone\nshow\nset [clone id v] to (y position)\nswitch costume to (clone id)\nforever\n    go to x: ((cam X) / ((-34) / (clone id))) y: ((cam Y) / ((-34) / (clone id)))\n    go to [back v] layer\n    go [forward v] (clone id) layers\n    change y by ((clone id) * (5))\nend\n\ndefine a\nhide\ngo to x: (0) y: (0)\ngo to [back v] layer\nrepeat (3)\n    change y by (1)\n    create clone of (_myself_ v)\nend\n\n@shadow\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nrepeat (3)\n    change y by (1)\n    create clone of (_myself_ v)\nend\n\ndefine goto ground\ngo to (player v)\nswitch costume to (small v)\nrepeat until <<touching (level hitbox v)?> or <touching (_edge_ v)?>>\n    change y by (-1)\nend\nchange y by (5)\nswitch costume to (down shadow v)\nset [ghost v] effect to (((distance to [player v]) / (2)) + (50))\nswitch costume to (big v)\nset size to (((100) - (distance to [player v])) + (40)) %\nswitch costume to (down shadow v)\n\nwhen I start as a clone\nset [id v] to (y position)\nshow\n\ndefine goto left\ngo to (player v)\nswitch costume to (small v)\nrepeat until <<touching (level hitbox v)?> or <touching (_edge_ v)?>>\n    change x by (-1)\nend\nchange x by (-10)\nset [ghost v] effect to ((distance to [player v]) + (50))\nswitch costume to (big v)\nset size to (((100) - (distance to [player v])) / (1)) %\nswitch costume to (left v)\n\ndefine goto right\ngo to (player v)\nswitch costume to (small v)\nrepeat until <<touching (level hitbox v)?> or <touching (_edge_ v)?>>\n    change x by (1)\nend\nchange x by (15)\nset [ghost v] effect to ((distance to [player v]) + (50))\nswitch costume to (big v)\nset size to (((100) - (distance to [player v])) / (1)) %\nswitch costume to (left v)\n\ngo to (player v)\nswitch costume to (small v)\nrepeat until <<touching (level hitbox v)?> or <touching (_edge_ v)?>>\n    change x by (1)\nend\nchange x by (-1)\nset [ghost v] effect to ((distance to [player v]) + (50))\nswitch costume to (big v)\nset size to (((100) - (distance to [player v])) + (30)) %\nswitch costume to (right v)\n\nwhen I receive [play v]\nif <(id) = [1]> then\n    go to [front v] layer\n    goto ground\nend\nif <(id) = [2]> then\n    go to [front v] layer\n    goto left\nend\nif <(id) = [3]> then\n    go to [front v] layer\n    goto right\nend\n\n@entities\n\ndefine clone (amount)\ngo to x: (0) y: (0)\nrepeat (amount)\n    change y by (1)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nhide\ngo to [back v] layer\ngo [forward v] (4) layers\nclone [7]\n\nwhen I start as a clone\nshow\nset [clone id v] to (y position)\n\nif <(clone ID) = [1]> then\n\nwhen I receive [play v]\nswitch costume to (costume1 v)\ngo to x: ((tree x) - (cam X)) y: ((tree y) - (cam Y))\nif <(clone ID) = [1]> then\n    if <(LEVEL #) = [1]> then\n        set [tree x v] to [366]\n        set [tree y v] to [322]\n        switch costume to (tall trees v)\n    else\n        set [tree x v] to [1215]\n        set [tree y v] to [322]\n        switch costume to (short trees v)\n    end\nelse\n    if <(clone ID) = [2]> then\n        if <(LEVEL #) = [1]> then\n            set [tree x v] to [1628]\n            set [tree y v] to [674]\n            switch costume to (short trees v)\n        else\n            set [tree x v] to [590]\n            set [tree y v] to [322]\n            switch costume to (tall trees v)\n        end\n    else\n        if <(clone ID) = [3]> then\n            if <(LEVEL #) = [1]> then\n                set [tree x v] to [2752]\n                set [tree y v] to [642]\n                switch costume to (tall trees v)\n            else\n                set [tree x v] to [1866]\n                set [tree y v] to [1122]\n                switch costume to (tall trees v)\n            end\n        else\n            if <(clone ID) = [4]> then\n                if <(LEVEL #) = [1]> then\n                    set [tree x v] to [3617]\n                    set [tree y v] to [418]\n                    switch costume to (big rock v)\n                else\n                    set [tree x v] to [2344]\n                    set [tree y v] to [1120]\n                    switch costume to (rock v)\n                end\n            else\n                if <(clone ID) = [5]> then\n                    if <(LEVEL #) = [1]> then\n                        set [tree x v] to [3100]\n                        set [tree y v] to [545]\n                        switch costume to (rock v)\n                    else\n                        set [tree x v] to [3180]\n                        set [tree y v] to [1185]\n                        switch costume to (big rock v)\n                    end\n                else\n                    if <(clone ID) = [6]> then\n                        if <(LEVEL #) = [1]> then\n                            set [tree x v] to [2158]\n                            set [tree y v] to [1634]\n                            switch costume to (rock v)\n                        else\n                            set [tree x v] to [2822]\n                            set [tree y v] to [1888]\n                            switch costume to (tall trees v)\n                        end\n                    else\n                        if <(clone ID) = [7]> then\n                            if <(LEVEL #) = [3]> then\n                                show\n                                set [tree x v] to [367]\n                                set [tree y v] to [320]\n                                switch costume to (make ur own :\) v)\n                            else\n                                hide\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\n@border\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n@editor\n\ndefine get tile at (x) (y)\nset [tile grid x v] to ([floor v] of ((x) / (32)) )\nset [tile grid y v] to ([floor v] of ((y) / (32)) )\nset [mouse on v] to (((1) + (tile grid y)) + ((tile grid x) * (grid height)))\n\nwhen flag clicked\nset [ghost v] effect to (50)\nforever\n    show\n    if <(!MODE) = [edit]> then\n        get tile at ((mouse x) + (cam X)) ((mouse y) + (cam Y))\n        if <mouse down?> then\n            replace item (mouse on) of [tiles v] with (tile select)\n        end\n        switch costume to (tile select)\n        go to x: (0) y: (140)\n    else\n        hide\n    end\nend\n\nwhen [left arrow v] key pressed\nchange [tile select v] by (-1)\nif <(tile select) < [4]> then\n    set [tile select v] to [49]\nend\n\nwhen [right arrow v] key pressed\nchange [tile select v] by (1)\nif <[49] < (tile select)> then\n    set [tile select v] to [4]\nend\n\nwhen flag clicked\nforever\n    if <key (e v) pressed?> then\n        set [!mode v] to [edit]\n        wait until <not <key (e v) pressed?>>\n        wait until <key (e v) pressed?>\n        set [!mode v] to [idle]\n        wait until <not <key (e v) pressed?>>\n    end\nend\n\n@Level Store\n\ndefine write value (value) delimiter (letter)\nset [encoded v] to (join (encoded) (join (value) (letter)))\n\ndefine save level (level #)\nset [encoded v] to []\nwrite value [1] delimiter [_]\nwrite value (grid width) delimiter [_]\nwrite value (grid height) delimiter [_]\nset [tile index v] to [1]\nset [tile v] to (item (tile index) of [tiles v])\nset [length v] to [0]\nrepeat (grid height)\n    repeat (grid width)\n        if <<(length) < [26]> and <(tile) = (item (tile index) of [tiles v])>> then\n            change [length v] by (1)\n        else\n            if <(tile) = [2]> then\n                set [tile v] to []\n            end\n            write value (tile) delimiter (item (length) of [a to z v])\n            set [tile v] to (item (tile index) of [tiles v])\n            set [length v] to [1]\n        end\n        change [tile index v] by (grid height)\n    end\n    change [tile index v] by ((1) - ((grid width) * (grid height)))\nend\nwrite value (tile) delimiter (item (length) of [a to z v])\nrepeat ((level #) - (length of [level store v]))\n    add [] to [level store v]\nend\nreplace item (level #) of [level store v] with (encoded)\n\ndefine load level (level #)\nset [encoded v] to (item (level #) of [level store v])\nset [read index v] to [1]\nread value\nif <not <(value) = [1]>> then\n    stop [this script v]\nend\ndelete all of [tiles v]\nread value\nset [grid width v] to (value)\nread value\nset [grid height v] to (value)\nrepeat ((grid width) * (grid height))\n    add [] to [tiles v]\nend\nset [tile index v] to [1]\nrepeat until <(read index) > (length of (encoded))>\n    read value\n    if <(value) = []> then\n        set [value v] to [2]\n    end\n    repeat (item # of (letter) in [a to z v])\n        replace item (tile index) of [tiles v] with (value)\n        change [tile index v] by (grid height)\n        if <(tile index) > ((grid width) * (grid height))> then\n            change [tile index v] by ((1) - ((grid width) * (grid height)))\n            if <(tile index) > (grid height)> then\n                stop [this script v]\n            end\n        end\n    end\nend\n\ndefine read letter\nset [letter v] to (letter (read index) of (encoded))\nchange [read index v] by (1)\n\ndefine read value\nset [value v] to []\nread letter\nrepeat until <<(letter) > [9]> or <(letter) = []>>\n    set [value v] to (join (value) (letter))\n    read letter\nend\n\nwhen I receive [level - save v]\nsave level (LEVEL #)\n\nwhen I receive [level - load v]\nload level (LEVEL #)\nbroadcast (LEVEL - Done Loading... v) and wait\n\nwhen [o v] key pressed\nbroadcast (LEVEL - Save v)\n\nwhen [p v] key pressed\nbroadcast (LEVEL - Load v)\n\nwhen flag clicked\nset [level # v] to [1]\n\nchange [level # v] by (1)\n\n@bridge hitbox\n\nwhen flag clicked\nswitch costume to (blank v)\nset size to (1600) %\nswitch costume to (level 1 v)\n\nwhen I receive [play v]\ngo to x: ((cam X) * (-1)) y: ((cam Y) * (-1))\nswitch costume to ((LEVEL #) + (1))\nif <(!MODE) = [edit]> then\n    set [ghost v] effect to (75)\nelse\n    set [ghost v] effect to (100)\nend\n\n@particles\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\nswitch costume to (smoke1 v)\nset [particle x v] to (x)\nset [particle y v] to ((y) - (10))\nset [particle yvel v] to (((Yvel) * (0.5)) + (pick random (1) to (-1)))\nset [particle x vel v] to (((Xvel) * (0.5)) + (pick random (-3) to (3)))\nset [particle life v] to [0]\nforever\n    change [particle yvel v] by (-0.7)\n    change [particle x v] by (particle x vel)\n    if <touching (level hitbox v)?> then\n        change [particle x v] by ((particle x vel) * (-1))\n        set [particle x vel v] to [0]\n    end\n    change [particle y v] by (particle yvel)\n    if <touching (level hitbox v)?> then\n        change [particle y v] by ((particle yvel) * (-1))\n        set [particle yvel v] to [0]\n    end\n    change [particle life v] by (pick random (0.5) to (1))\n    if <(particle life) > [5]> then\n        switch costume to (smoke2 v)\n    end\n    if <(particle life) > [10]> then\n        delete this clone\n    end\n    change [ghost v] effect by ((particle life) / (1.5))\nend\n\nwhen I receive [play v]\ngo to x: ((round (particle x)) - (round (cam X))) y: ((round (particle y)) - (round (cam Y)))\n\n@effects\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\nswitch costume to (thumbnail v)\nforever\n    go to [front v] layer\nend\n\nwhen I receive [next level v]\nswitch costume to (next level v)\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nset [ghost v] effect to (100)\nswitch costume to (thumbnail v)\n\nwhen I receive [die v]\nswitch costume to (die v)\nshow\nrepeat (5)\n    change [ghost v] effect by (-10)\nend\nrepeat (5)\n    change [ghost v] effect by (10)\nend\nset [ghost v] effect to (100)\nswitch costume to (thumbnail v)\n\n