Platformer game DEMO

Instructions: Instructions are in game, but there's kind of a lot of them, so I'll put them here too:\n\nBASIC CONTROLS:\nArrows/WASD to move/jump\nS to crouch\nZ to attack\nSPECIAL CONTROLS:\nHold crouch and then jump to do a flip\nHold crouch while moving to slide\nJump while sliding on a wall to wall jump\nCONTROL COMBINATIONS:\nHold crouch + attack to roll\nJump and then press Z to high jump\n\nYour green energy bar will deplete as you do various activities. It will refill by standing still, and it will refill faster if you crouch.\nDon't touch any sharp points or fall out of the world\nGet to the glowing side of the screen to win!

@Stage\n\n@Load\n\nwhen flag clicked\nbroadcast (GREEN FLAG v) and wait\nbroadcast (reset everything v) and wait\nbroadcast (start game v)\n\nwhen I receive [reset everything v]\nload\n\nwhen I receive [start game v]\nforever\n    broadcast (position v)\nend\n\ndefine load\nset [world width v] to [12]\ndelete all of [ground_x v]\ndelete all of [ground_y v]\nset [y v] to [-1]\nrepeat (3)\n    set [x v] to [-2]\n    repeat (world width)\n        add (x) to [ground_x v]\n        add (y) to [ground_y v]\n        change [x v] by (1)\n    end\n    change [y v] by (1)\nend\n\n@player\n\ndefine reset\nset size to (70) %\npoint in direction (90)\nset rotation style [left-right v]\ngo to x: (0) y: (0)\nset [crouching v] to [0]\nset [direction v] to [0]\nset [flip v] to [0]\nset [sliding v] to [0]\nset [slipping v] to [0]\nset [motion v] to [-20]\nset [health v] to [5]\nset [energy v] to [50]\nset [speed v] to [0]\nset [falling speed v] to [0]\nset [attack type v] to [0]\nif <(level) = [0]> then\n    set [player x v] to [-850]\n    set [player y v] to [0]\nelse\n    set [player x v] to [-1000]\n    set [player y v] to [-420]\nend\n\ndefine touch ground\nset [touching ground? v] to [0]\nset [slope v] to [0]\nif <(falling speed) < [0]> then\n    if < or <touching (ground \(tutorial\) v)?>> then\n        set [falling speed v] to ((falling speed) * (0.7))\n    end\n    change y by (-1)\n    repeat until <<(slope) = [60]> or <not < or <touching (ground \(tutorial\) v)?>>>>\n        set [touching ground? v] to [1]\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <(slope) > [1]> then\n        set [fall count v] to [0]\n    end\nelse\n    repeat until <<(slope) = [-60]> or <not < or <touching (ground \(tutorial\) v)?>>>>\n        set [falling speed v] to [-1]\n        change [slope v] by (-1)\n        change y by (-1)\n    end\nend\nif <(slope) = [60]> then\n    change y by (((0) - (slope)) + (1))\n    fix collision from (x position) (y position) [50]\n    set [touching ground? v] to [0]\nelse\n    if <(slope) = [-60]> then\n        change y by (((0) - (slope)) + (-11))\n        fix collision from (x position) (y position) [50]\n        set [touching ground? v] to [0]\n    end\nend\n\ndefine wall detection\nset [wall x v] to (x position)\nchange x by ((speed) / (1))\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not < or <touching (ground \(tutorial\) v)?>>>>\n    change [slope v] by (1)\n    change y by (1)\nend\nif <<(slope) > [1]> and <(crouching) = [1]>> then\n    if <(flip) = [roll]> then\n        set [speed v] to ((speed) / ((slope) / (3)))\n    else\n        set [speed v] to ((speed) / (slope))\n    end\nend\nif <(slope) = [8]> then\n    if <(flip) = [active]> then\n        set x to (wall x)\n        change y by (() - (slope))\n        set [speed v] to ((0) - (speed))\n    else\n        set x to (wall x)\n        change y by (() - (slope))\n    end\nend\nif <<(touching ground?) = [0]> and < or <touching (ground \(tutorial\) v)?>>> then\n    change y by (2)\n    repeat (8)\n        change x by (-1)\n        if <not < or <touching (ground \(tutorial\) v)?>>> then\n            stop [this script v]\n        end\n    end\n    change x by (8)\n    repeat (8)\n        change x by (1)\n        if <not < or <touching (ground \(tutorial\) v)?>>> then\n            stop [this script v]\n        end\n    end\n    change x by (-8)\n    change y by (-2)\n    fix collision from (x position) (y position) [60]\nend\n\ndefine center camera\nchange [player x v] by (round ((x position) - (last x)))\nchange [player y v] by (round ((y position) - (last y)))\nchange [camera x v] by (round (((player x) - (camera x)) / (5)))\nchange [camera y v] by (round (((player y) - (camera y)) / (5)))\nif <(screen shake) > [0]> then\n    change [camera x v] by (pick random (5) to (-5))\n    change [camera y v] by (pick random (5) to (-5))\nend\nif <(camera x) < ((-2) * (480))> then\n    set [camera x v] to ((-2) * (480))\nend\nif <(camera x) > (((world width) - (3)) * (480))> then\n    set [camera x v] to (((world width) - (3)) * (480))\nend\nif <(camera y) < ((-1) * (360))> then\n    set [camera y v] to ((-1) * (360))\nend\nif <(camera y) > ((1) * (360))> then\n    set [camera y v] to ((1) * (360))\nend\ngo to x: ((player x) + (() - (camera x))) y: ((player y) + (() - (camera y)))\nif < or <touching (hurt \(tutorial\) v)?>> then\n    if <(previous direction) > [0]> then\n        set [idle costume v] to [slip l]\n        set [speed v] to [-5]\n    else\n        set [idle costume v] to [slip r]\n        set [speed v] to [5]\n    end\n    if <(falling speed) > [0]> then\n        set [falling speed v] to [-2]\n    else\n        set [falling speed v] to [11]\n    end\n    change [health v] by (-1)\n    if <<(health) < [1]> or <(player y) < [-530]>> then\n        set [health v] to [0]\n        start sound [Dead v]\n        change y by (-5)\n        switch costume to (dead v)\n        broadcast (screen shake v)\n        wait (1) seconds\n        broadcast (reset v)\n        stop [this script v]\n    end\nend\nif <<(health) < [1]> or <(player y) < [-530]>> then\n    set [health v] to [0]\n    start sound [Dead v]\n    change y by (2)\n    switch costume to (dead v)\n    broadcast (screen shake v)\n    wait (1) seconds\n    broadcast (reset v)\n    stop [this script v]\nend\nif <(player x) > [4550]> then\n    broadcast (win v)\nend\n\ndefine detect slope\nset [slipping v] to [0]\nchange y by (-3)\nchange x by (2)\nif <not < or <touching (ground \(tutorial\) v)?>>> then\n    change [speed v] by (4)\n    set [jump count v] to [4]\n    set [touching ground? v] to [1]\n    set [motion v] to [0]\n    set [slipping v] to [1]\n    set [idle costume v] to [slide l]\n    start sound [Slip v]\nend\nchange x by (-4)\nif <not < or <touching (ground \(tutorial\) v)?>>> then\n    change [speed v] by (-4)\n    set [fall count v] to [4]\n    set [touching ground? v] to [1]\n    set [motion v] to [0]\n    set [slipping v] to [1]\n    set [idle costume v] to [slide r]\n    start sound [Slip v]\nend\nchange y by (3)\nchange x by (2)\n\ndefine set costume\nset rotation style [left-right v]\nif <not <(attack type) = [0]>> then\n    switch costume to ((attack type) + (33))\nelse\n    if <(flip) = [roll]> then\n        switch costume to (flip v)\n        set rotation style [all around v]\n        point in direction (direction)\n    else\n        if <(flip) = [active]> then\n            switch costume to (flip v)\n            if <(speed) > [0]> then\n                set rotation style [all around v]\n                point in direction ((timer) * (1100))\n            else\n                set rotation style [all around v]\n                point in direction ((timer) * (-1100))\n            end\n        else\n            if <(idle costume) = [punch]> then\n                switch costume to (punch 1 v)\n            else\n                if <(idle costume) = [punch2]> then\n                    switch costume to (punch 2 v)\n                else\n                    if <(idle costume) = [crouch]> then\n                        point in direction (previous direction)\n                        switch costume to (crouch v)\n                    else\n                        if <(idle costume) = [crouch r]> then\n                            point in direction (90)\n                            switch costume to (crouch left v)\n                        else\n                            if <(idle costume) = [crouch l]> then\n                                point in direction (90)\n                                switch costume to (crouch right v)\n                            else\n                                if <(idle costume) = [slide l]> then\n                                    point in direction (90)\n                                    switch costume to (slip left v)\n                                else\n                                    if <(idle costume) = [slide r]> then\n                                        point in direction (90)\n                                        switch costume to (slip right v)\n                                    else\n                                        if <(idle costume) = [wall l]> then\n                                            point in direction (90)\n                                            switch costume to (slide left v)\n                                        else\n                                            if <(idle costume) = [wall r]> then\n                                                point in direction (90)\n                                                switch costume to (slide right v)\n                                            else\n                                                if <(round (falling speed)) > [1]> then\n                                                    switch costume to (jump v)\n                                                else\n                                                    if <(fall count) > [10]> then\n                                                        switch costume to (fall v)\n                                                    else\n                                                        if <(round ([abs v] of (speed) )) > [0]> then\n                                                            change [motion costume v] by (1.5)\n                                                            switch costume to ((1) + ((round (motion costume)) mod (9)))\n                                                        else\n                                                            set [motion costume v] to [0]\n                                                            if <<(round ([abs v] of (speed) )) > [0]> and <(motion) > [2]>> then\n                                                                switch costume to (stand 1 v)\n                                                            else\n                                                                switch costume to (hitbox angle 1 v)\n                                                                repeat (4)\n                                                                    if <not < or <touching (ground \(tutorial\) v)?>>> then\n                                                                        switch costume to ((costume [number v]) + (5))\n                                                                        stop [this script v]\n                                                                    end\n                                                                    next costume\n                                                                end\n                                                                switch costume to (stand 1 v)\n                                                            end\n                                                        end\n                                                    end\n                                                end\n                                            end\n                                        end\n                                        if <(slipping) = [1]> then\n                                            switch costume to (hitbox angle 1 v)\n                                            repeat (4)\n                                                if <not < or <touching (ground \(tutorial\) v)?>>> then\n                                                    switch costume to ((costume [number v]) + (5))\n                                                    stop [this script v]\n                                                end\n                                                next costume\n                                            end\n                                            switch costume to (stand 1 v)\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                    if <<((timer) mod (0.2)) < [0.04]> and <<<(sliding) = [1]> or <(slipping) = [1]>> or <<([abs v] of (round (speed)) ) > [0]> and <(crouching) = [1]>>>> then\n                        create clone of (dust v)\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine wall jump\nset [idle costume v] to []\npoint in direction (90)\nswitch costume to (wall slide right v)\nif <<< or <touching (ground \(tutorial\) v)?>> and <(falling speed) < [5]>> and <(touching ground?) = [0]>> then\n    change [sliding v] by (1)\n    set [falling speed v] to [-3]\n    set [idle costume v] to [wall r]\n    if <<(sliding) > [3]> and <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n        if <((energy) - (4)) > [0]> then\n            set [falling speed v] to [15]\n            set [motion v] to [-20]\n            set [speed v] to [-9]\n            set [touching ground? v] to [0]\n            change [energy v] by (-4)\n        end\n    end\n    switch costume to (hitbox angle 0 v)\n    point in direction (speed)\n    stop [this script v]\nend\nswitch costume to (wall slide left v)\nif <<< or <touching (ground \(tutorial\) v)?>> and <(falling speed) < [5]>> and <(touching ground?) = [0]>> then\n    change [sliding v] by (1)\n    set [falling speed v] to [-3]\n    set [idle costume v] to [wall l]\n    if <<(sliding) > [3]> and <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n        if <((energy) - (4)) > [0]> then\n            set [falling speed v] to [15]\n            set [speed v] to [9]\n            set [motion v] to [-20]\n            set [touching ground? v] to [0]\n            change [energy v] by (-4)\n        end\n    end\n    switch costume to (hitbox angle 0 v)\n    point in direction (speed)\n    stop [this script v]\nend\nset [sliding v] to [0]\nswitch costume to (hitbox angle 0 v)\npoint in direction (speed)\n\nwhen [r v] key pressed\nreset\n\nwhen I receive [reset v]\nstop [other scripts in sprite v]\nwait (0.8) seconds\nbroadcast (reset everything v)\nbroadcast (start game v)\nwait (2) seconds\n\nwhen I receive [start game v]\nbroadcast (sounds v)\nbroadcast (attacks v)\npoint in direction (90)\nclear graphic effects\nshow\nreset\nforever\n    if <(energy) < [50]> then\n        change [energy v] by (0.1)\n    end\n    if <<(crouching) = [1]> and <not <<key (s v) pressed?> or <key (down arrow v) pressed?>>>> then\n        change y by (0)\n        switch costume to (hitbox angle 0 v)\n        if < or <touching (ground \(tutorial\) v)?>> then\n            set [crouching v] to [1]\n            if <(round ([abs v] of (speed) )) = [0]> then\n                set [idle costume v] to [crouch]\n            else\n                if <(speed) > [0]> then\n                    set [idle costume v] to [crouch r]\n                else\n                    set [idle costume v] to [crouch l]\n                end\n            end\n        else\n            set [crouching v] to [0]\n        end\n        change y by (0)\n    end\n    if <<<(slipping) = [0]> and <<(touching ground?) = [1]> and <<key (s v) pressed?> or <key (down arrow v) pressed?>>>> and <not <(flip) = [roll]>>> then\n        if <(speed) > [0]> then\n            set [idle costume v] to [crouch r]\n        else\n            set [idle costume v] to [crouch l]\n        end\n        set [crouching v] to [1]\n        set [speed v] to ((speed) * (0.97))\n    else\n        change y by (0)\n        switch costume to (hitbox angle 0 v)\n        if <<(crouching) = [1]> and <not <<key (s v) pressed?> or <key (down arrow v) pressed?>>>> then\n            if < or <touching (ground \(tutorial\) v)?>> then\n                set [crouching v] to [1]\n                if <(round ([abs v] of (speed) )) = [0]> then\n                    set [idle costume v] to [crouch]\n                else\n                    if <(speed) > [0]> then\n                        set [idle costume v] to [crouch r]\n                    else\n                        set [idle costume v] to [crouch l]\n                    end\n                end\n            end\n        else\n            if <<(flip) = [active]> or <(touching ground?) = [0]>> then\n                set [speed v] to ((speed) * (0.98))\n            else\n                if <<(touching ground?) = [1]> and <(flip) = [roll]>> then\n                    set [speed v] to ((speed) * (0.98))\n                else\n                    set [speed v] to ((speed) * (0.6))\n                end\n            end\n        end\n    end\n    if <not <<(flip) = [roll]> or <(flip) = [active]>>> then\n        change [flip v] by (-1)\n    end\n    if <<(touching ground?) = [1]> and <(flip) = [active]>> then\n        set [flip v] to [0]\n    end\n    if <<not <(flip) = [roll]>> and <<(slipping) = [0]> and <<(round ([abs v] of (speed) )) = [0]> and <<(touching ground?) = [1]> and <<key (s v) pressed?> or <key (down arrow v) pressed?>>>>>> then\n        if <(energy) < [50]> then\n            change [energy v] by ((0.25) / (6))\n        end\n        set [idle costume v] to [crouch]\n        set [crouching v] to [1]\n        set [speed v] to [0]\n        set [flip v] to [3]\n    end\n    point in direction (speed)\n    if <not <(direction) = [0]>> then\n        set [previous direction v] to (direction)\n    end\n    if <<<(crouching) = [0]> and <<(motion) > [2]> and <<(attack type) = [0]> and <(touching ground?) = [1]>>>> and <not <(flip) = [active]>>> then\n        if <((energy) - ((speed) / (40))) > [1]> then\n            change [speed v] by ((<<key (d v) pressed?> or <key (right arrow v) pressed?>> - <<key (a v) pressed?> or <key (left arrow v) pressed?>>) * (2))\n            change [energy v] by ((0) - ([abs v] of ((speed) / (40)) ))\n        else\n            set [speed v] to [0]\n        end\n    end\n    change [motion v] by (1)\n    set [last y v] to (y position)\n    set [last x v] to (x position)\n    if <(crouching) = [0]> then\n        switch costume to (hitbox angle 0 v)\n    else\n        switch costume to (hitbox angle 5 v)\n    end\n    change [falling speed v] by (-1)\n    change [jump count v] by (1)\n    if <<(slipping) = [0]> and <<(touching ground?) = [1]> and <<[1] < (jump count)> and <<key (w v) pressed?> or <key (up arrow v) pressed?>>>>> then\n        if <(flip) > [0]> then\n            if <((energy) - (10)) > [0]> then\n                set [falling speed v] to [16]\n                if <(previous direction) > [0]> then\n                    set [speed v] to [8]\n                end\n                if <[0] > (previous direction)> then\n                    set [speed v] to [-8]\n                end\n                set [flip v] to [active]\n                change [energy v] by (-10)\n            end\n        else\n            if <((energy) - (4)) > [0]> then\n                set [falling speed v] to [10]\n                change [energy v] by (-4)\n                start sound [Jump v]\n            end\n        end\n    end\n    if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n        set [jump count v] to [0]\n    end\n    if <(falling speed) < [-25]> then\n        set [falling speed v] to [-25]\n    end\n    change [fall count v] by (1)\n    change y by (falling speed)\n    touch ground\n    if <(touching ground?) = [1]> then\n        detect slope\n    end\n    wall detection\n    if <<not <(flip) = [active]>> and <<(crouching) = [0]> and <(slipping) = [0]>>> then\n        wall jump\n    end\n    set costume\n    center camera\nend\n\nwhen I receive [reset everything v]\nhide\n\nwhen [r v] key pressed\nstart sound [Connect v]\nbroadcast (reset v) and wait\n\nwhen I receive [sounds v]\nforever\n    if <<(slipping) = [0]> and <<(touching ground?) = [1]> and <(falling speed) < [-5]>>> then\n        if <((0) - (round ((([abs v] of (falling speed) ) - (12)) / (5)))) < [0]> then\n            change [health v] by ((0) - (round ((([abs v] of (falling speed) ) - (12)) / (5))))\n        end\n        wait (0) seconds\n        if <(crouching) = [1]> then\n            set volume to (50) %\n            play sound [Drop v] until done\n            set volume to (100) %\n        else\n            set volume to (100) %\n            start sound [Drop v]\n        end\n        wait until <not <<(touching ground?) = [1]> and <(falling speed) < [-5]>>>\n    end\nend\n\nwhen [q v] key pressed\nif <[developer usernames v] contains (username)?> then\n    change [player y v] by (100)\n    set [falling speed v] to [0]\nend\n\nwhen I receive [attacks v]\nforever\n    if <<<key (m v) pressed?> or <key (z v) pressed?>> and <not <<<(sliding) = [1]> or <(slipping) = [1]>> or <<(flip) = [roll]> or <(flip) = [active]>>>>> then\n        if <((energy) - (2)) > [0]> then\n            if <(crouching) = [1]> then\n                change [energy v] by (-2)\n                set [flip v] to [roll]\n                start sound [Low Whoosh v]\n                change [falling speed v] by (10)\n                set [direction v] to [90]\n                if <(previous direction) > [0]> then\n                    set [speed v] to [10]\n                else\n                    set [speed v] to [-10]\n                end\n                repeat until <(touching ground?) = [1]>\n                    set [crouching v] to [1]\n                    set [flip v] to [roll]\n                    set [motion v] to [-1]\n                    change [direction v] by ((speed) * (3))\n                end\n                repeat until <not <key (z v) pressed?>>\n                    set [crouching v] to [1]\n                    set [flip v] to [roll]\n                    set [motion v] to [-1]\n                    change [direction v] by ((speed) * (3))\n                end\n                set [flip v] to [0]\n            else\n                if <(falling speed) > [0]> then\n                    change [energy v] by (-2)\n                    set [motion v] to [-5]\n                    change [falling speed v] by (5)\n                    set [attack type v] to [8]\n                    start sound [Low Whoosh v]\n                    wait (0.3) seconds\n                    set [attack type v] to [9]\n                    wait (0.1) seconds\n                    set [attack type v] to [0]\n                    wait until <<(sliding) = [1]> or <(touching ground?) = [1]>>\n                else\n                    if <(attack combo) > [3]> then\n                        change [energy v] by (-2)\n                        set [motion v] to [-5]\n                        set [attack type v] to [6]\n                        start sound [Low Whoosh v]\n                        wait (0.1) seconds\n                        set [attack type v] to [7]\n                        wait (0.4) seconds\n                        set [attack combo v] to [-1]\n                    else\n                        if <(attack combo) > [0]> then\n                            change [energy v] by (-2)\n                            set [motion v] to [-5]\n                            set [attack type v] to [3]\n                            start sound [Low Whoosh v]\n                            wait (0.1) seconds\n                            set [attack type v] to [4]\n                            wait (0.1) seconds\n                            set [attack type v] to [5]\n                            wait (0.1) seconds\n                            set [attack combo v] to [6]\n                        else\n                            change [energy v] by (-2)\n                            set [motion v] to [-5]\n                            set [attack type v] to [1]\n                            start sound [Low Whoosh v]\n                            wait (0.1) seconds\n                            set [attack type v] to [2]\n                            wait (0.1) seconds\n                            set [attack type v] to [1]\n                            wait (0.1) seconds\n                            set [attack combo v] to [4]\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [attack combo v] by (-1)\n    set [attack type v] to [0]\n    wait until <not <<key (m v) pressed?> or <key (z v) pressed?>>>\nend\n\ndefine check for tight space\nif < or <touching (ground \(tutorial\) v)?>> then\n    set [crouching v] to [1]\n    if <(round ([abs v] of (speed) )) = [0]> then\n        set [idle costume v] to [crouch]\n    else\n        if <(speed) > [0]> then\n            set [idle costume v] to [crouch r]\n        else\n            set [idle costume v] to [crouch l]\n        end\n    end\nelse\n    set [crouching v] to [0]\nend\n\nwhen I receive [win v]\nstart sound [Win v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [green flag v]\nset [level v] to [0]\n\ndefine fix collision from (x) (y) (max)\nset rotation style [don't rotate v]\nset [original v] to (direction)\nset [change v] to [1]\nrepeat (max)\n    repeat (16)\n        go to x: (x) y: (y)\n        move (change) steps\n        if <not < or <touching (ground \(tutorial\) v)?>>> then\n            point in direction (original)\n            set rotation style [all around v]\n            stop [this script v]\n        end\n        turn right ((360) / (16)) degrees\n    end\n    change [change v] by (1)\nend\nset rotation style [all around v]\n\nfix collision from (x position) (y position) [100]\n\nwhen [e v] key pressed\nif <[developer usernames v] contains (username)?> then\n    broadcast (win v) and wait\nend\n\nwhen [t v] key pressed\nif <[developer usernames v] contains (username)?> then\n    set [energy v] to [50]\n    set [health v] to [5]\nend\n\n@Dust\n\nwhen I receive [reset everything v]\nhide\ndelete this clone\n\nwhen I start as a clone\ngo to [front v] layer\nset [x v] to (player x)\nset [y v] to ((player y) - (15))\ngo to x: ((x) - (camera x)) y: ((y) - (camera y))\nturn left (1) degrees\nclear graphic effects\nshow\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [position v]\ngo to x: ((x) - (camera x)) y: ((y) - (camera y))\nturn left (1) degrees\n\n@Health\n\nwhen flag clicked\nhide\nclone\n\ndefine clone\nswitch costume to (costume2 v)\ngo to x: (-196) y: (-136)\ncreate clone of (_myself_ v)\nswitch costume to (costume4 v)\ncreate clone of (_myself_ v)\nswitch costume to (costume3 v)\ncreate clone of (_myself_ v)\nswitch costume to (costume5 v)\ngo to x: (-124) y: (-120)\ncreate clone of (_myself_ v)\nswitch costume to (costume7 v)\ncreate clone of (_myself_ v)\nswitch costume to (costume6 v)\ncreate clone of (_myself_ v)\nswitch costume to (costume5 v)\ngo to x: (-124) y: (-150)\ncreate clone of (_myself_ v)\nswitch costume to (costume1 v)\ngo to x: (-196) y: (-136)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\ngo to [front v] layer\nif <(costume [number v]) = [3]> then\n    forever\n        go to x: ((-190) + (((health) + (1)) * (11))) y: (-120)\n    end\nend\nif <(costume [number v]) = [4]> then\n    go to x: ((-190) + (((health) + (1)) * (11))) y: (-120)\n    forever\n        change x by ((((-190) + (((health) + (1)) * (11))) - (x position)) / (5))\n    end\nend\nif <(costume [number v]) = [5]> then\n    forever\n        go to x: ((-190) + (((((energy) + (10)) * (11)) / (10)) - (1))) y: (-150)\n    end\nend\nif <(costume [number v]) = [6]> then\n    go to x: (-123) y: (-150)\n    forever\n        change x by ((((-190) + (((((energy) + (10)) * (11)) / (10)) - (1))) - (x position)) / (5))\n    end\nend\n\nwhen I receive [win v]\nhide\n\n@Transition\n\ndefine clone\nif <(clones?) = [0]> then\n    set [clones? v] to [1]\n    hide\n    go to x: (-240) y: (180)\n    repeat (10)\n        set x to (-240)\n        repeat (13)\n            create clone of (_myself_ v)\n            change x by (40)\n        end\n        change y by (-40)\n    end\nend\n\nwhen I start as a clone\nturn right (180) degrees\nset [ghost v] effect to (0)\nset size to (0) %\ngo to [front v] layer\nwait ((((y position) + (180)) + ((x position) + (240))) / (1500)) seconds\nshow\nrepeat (15)\n    change size by (((101) - (size)) / (3))\nend\nwait (0.5) seconds\nrepeat (6)\n    change size by (((0) - (size)) / (4))\nend\ndelete this clone\n\nwhen I receive [reset v]\nclone\nwait (1.7) seconds\nset [clones? v] to [0]\n\nwhen I receive [win v]\nclone\nwait (2.5) seconds\nstop [all v]\n\nwhen I receive [reset everything v]\nset [clones? v] to [0]\n\n@Backdrop\n\nwhen flag clicked\nset size to (150) %\nforever\n    go to x: (((camera x) / (-5)) mod (30)) y: (((camera y) / (-5)) mod (30))\n    go to [back v] layer\n    switch costume to ((level) + (1))\nend\n\n@Ground (Tutorial)\n\nwhen I receive [reset everything v]\nset [ghost v] effect to (100)\nhide\ndelete this clone\n\nwhen I receive [start game v]\nif <(level) = [0]> then\n    clone ground\nend\n\nwhen I start as a clone\nclear graphic effects\nshow\nset [ghost v] effect to (0)\n\ndefine clone ground\nset [id v] to [0]\nset [constant id v] to [0]\nset [constant id y v] to [0]\nrepeat (2)\n    change [id v] by (1)\n    create clone of (_myself_ v)\n    change [constant id v] by (1)\nend\nset [id v] to (world width)\nset [constant id v] to [0]\nset [constant id y v] to [1]\nrepeat (2)\n    change [id v] by (1)\n    create clone of (_myself_ v)\n    change [constant id v] by (1)\nend\n\nwhen I receive [position v]\nset size to (100) %\ngo to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nif <((-480) + ((constant ID) * (480))) > (x position)> then\n    change [id v] by (1)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <(x position) > ((0) + ((constant ID) * (480)))> then\n    change [id v] by (-1)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <((-360) + ((constant ID y) * (360))) > (y position)> then\n    change [id v] by (world width)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <(y position) > ((0) + ((constant ID y) * (360)))> then\n    change [id v] by ((0) - (world width))\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nswitch costume to (ID)\n\n@Background (Tutorial)\n\nwhen I receive [reset everything v]\nset [ghost v] effect to (100)\nhide\ndelete this clone\n\nwhen I receive [start game v]\nif <(level) = [0]> then\n    clone ground\nend\n\nwhen I start as a clone\nclear graphic effects\nshow\ngo to [back v] layer\nset [ghost v] effect to (0)\n\ndefine clone ground\nset [id v] to [0]\nset [constant id v] to [0]\nset [constant id y v] to [0]\nrepeat (2)\n    change [id v] by (1)\n    create clone of (_myself_ v)\n    change [constant id v] by (1)\nend\nset [id v] to (world width)\nset [constant id v] to [0]\nset [constant id y v] to [1]\nrepeat (2)\n    change [id v] by (1)\n    create clone of (_myself_ v)\n    change [constant id v] by (1)\nend\n\nwhen I receive [position v]\nset size to (100) %\ngo to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nif <((-480) + ((constant ID) * (480))) > (x position)> then\n    change [id v] by (1)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <(x position) > ((0) + ((constant ID) * (480)))> then\n    change [id v] by (-1)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <((-360) + ((constant ID y) * (360))) > (y position)> then\n    change [id v] by (world width)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <(y position) > ((0) + ((constant ID y) * (360)))> then\n    change [id v] by ((0) - (world width))\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nswitch costume to (ID)\n\n@Hurt (Tutorial)\n\nwhen I receive [reset everything v]\nset [ghost v] effect to (100)\nhide\ndelete this clone\n\nwhen I receive [start game v]\nif <(level) = [0]> then\n    clone ground\nend\n\nwhen I start as a clone\nclear graphic effects\nshow\nset [ghost v] effect to (100)\n\ndefine clone ground\nset [id v] to [0]\nset [constant id v] to [0]\nset [constant id y v] to [0]\nrepeat (2)\n    change [id v] by (1)\n    create clone of (_myself_ v)\n    change [constant id v] by (1)\nend\nset [id v] to (world width)\nset [constant id v] to [0]\nset [constant id y v] to [1]\nrepeat (2)\n    change [id v] by (1)\n    create clone of (_myself_ v)\n    change [constant id v] by (1)\nend\n\nwhen I receive [position v]\nset size to (100) %\ngo to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nif <((-480) + ((constant ID) * (480))) > (x position)> then\n    change [id v] by (1)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <(x position) > ((0) + ((constant ID) * (480)))> then\n    change [id v] by (-1)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <((-360) + ((constant ID y) * (360))) > (y position)> then\n    change [id v] by (world width)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <(y position) > ((0) + ((constant ID y) * (360)))> then\n    change [id v] by ((0) - (world width))\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nswitch costume to (ID)\n\n@Background Level 1\n\nwhen I receive [reset everything v]\nset [ghost v] effect to (100)\nhide\ndelete this clone\n\nwhen I receive [start game v]\nif <(level) = [1]> then\n    clone ground\nend\n\nwhen I start as a clone\nclear graphic effects\nshow\ngo to [back v] layer\nset [ghost v] effect to (0)\n\ndefine clone ground\nset [id v] to [0]\nset [constant id v] to [0]\nset [constant id y v] to [0]\nrepeat (2)\n    change [id v] by (1)\n    create clone of (_myself_ v)\n    change [constant id v] by (1)\nend\nset [id v] to (world width)\nset [constant id v] to [0]\nset [constant id y v] to [1]\nrepeat (2)\n    change [id v] by (1)\n    create clone of (_myself_ v)\n    change [constant id v] by (1)\nend\n\nwhen I receive [position v]\nset size to (100) %\ngo to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nif <((-480) + ((constant ID) * (480))) > (x position)> then\n    change [id v] by (1)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <(x position) > ((0) + ((constant ID) * (480)))> then\n    change [id v] by (-1)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <((-360) + ((constant ID y) * (360))) > (y position)> then\n    change [id v] by (world width)\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nif <(y position) > ((0) + ((constant ID y) * (360)))> then\n    change [id v] by ((0) - (world width))\n    go to x: (((item (ID) of [ground_x v]) * (480)) - (camera x)) y: (((item (ID) of [ground_y v]) * (360)) - (camera y))\nend\nswitch costume to (ID)\n\n@Thumbnail\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\nswitch costume to (costume1 v)\n\nwhen I receive [win v]\nwait (1) seconds\nshow\nclear graphic effects\nswitch costume to (costume2 v)\n\n