Blue a Platformer 
@Stage\n\n@PLAYER\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\nbroadcast (BEGINNING v)\n\nwhen I receive [start v]\nshow\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nhide\nset [clone id v] to []\nset volume to (100) %\nforever\n    play sound [Deltarune Chapter 2 OST_ 15 - Smart Race \(1\) v] until done\nend\n\ndefine RESET AT X: (x) Y: (y)\nset [player x v] to (x)\nset [player y v] to (y)\nset [scroll x v] to (x)\nset [scroll y v] to (y)\nset [xv v] to [0]\nset [yv v] to [0]\ndelete all of [respawn x v]\ndelete all of [respawn y v]\nUPDATE CHECKPOINTS [200]\n\ndefine PLAY: GRAVITY: (gravity) JUMP HEIGHT: (jump height) SPEED: (speed) SLOPE: (slope)\nswitch costume to (hitbox v)\nchange [yv v] by (gravity)\nif <(YV) < [-30]> then\n    set [yv v] to [-30]\nend\nchange y by (YV)\nchange [player y v] by (YV)\nchange [touching floor v] by (-1)\nif <touching (ground v)?> then\n    set [touching floor v] to [4]\n    repeat until <not <touching (ground v)?>>\n        change y by ((([abs v] of (YV) ) / (YV)) * (-1))\n        change [player y v] by ((([abs v] of (YV) ) / (YV)) * (-1))\n    end\n    if <<(([abs v] of (YV) ) / (YV)) = [-1]> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [yv v] to (jump height)\n        start sound [jump v]\n    else\n        set [yv v] to [0]\n    end\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [xv v] by (speed)\n    point in direction (90)\nelse\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by ((speed) * (-1))\n        point in direction (-90)\n    end\nend\nset [xv v] to ((XV) * (.7))\nchange x by (XV)\nchange [player x v] by (XV)\nif <touching (ground v)?> then\n    set [slope v] to [0]\n    repeat until <<(SLOPE) = (slope)> or <not <touching (ground v)?>>>\n        change y by (1)\n        change [player y v] by (1)\n        change [slope v] by (1)\n    end\n    if <touching (ground v)?> then\n        change y by ((SLOPE) * (-1))\n        change [player y v] by ((SLOPE) * (-1))\n        repeat until <not <touching (ground v)?>>\n            change x by ((([abs v] of (XV) ) / (XV)) * (-1))\n            change [player x v] by ((([abs v] of (XV) ) / (XV)) * (-1))\n        end\n        set [xv v] to [0]\n    end\nend\nPAINT SPRITE\nSCROLL\nUPDATE CHECKPOINTS [200]\n\ndefine PAINT SPRITE\nswitch costume to (idle v)\nif <<(TOUCHING FLOOR) > [2]> and <([abs v] of (XV) ) > [2]>> then\n    switch costume to (join [walk ] ((1) + (([floor v] of ((timer) * (20)) ) mod (5))))\nend\nif <(YV) > [2]> then\n    switch costume to (jump v)\nelse\n    if <(YV) < [-3]> then\n        switch costume to (fall v)\n    end\nend\n\ndefine SCROLL\nchange [scroll x v] by (round (((PLAYER X) - (SCROLL X)) / (3)))\nchange [scroll y v] by (round (((PLAYER Y) - (SCROLL Y)) / (3)))\nCHECK POSITION\nbroadcast (SCROLL v)\n\ndefine CHECK POSITION\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nif <(SCROLL X) < [-480]> then\n    set [scroll x v] to [-480]\nend\nif <[20107] < (SCROLL X)> then\n    set [scroll x v] to [20107]\nend\nif <touching (spikes v)?> then\n    broadcast (RESPAWN v)\n    stop [this script v]\nend\nif <(PLAYER Y) < [-360]> then\n    broadcast (RESPAWN v)\n    stop [this script v]\nend\nif <[20107] < (PLAYER X)> then\n    broadcast (END v)\n    stop [this script v]\nend\n\nwhen I receive [scroll v]\nset size to (8000) %\ngo to x: ((PLAYER X) - (SCROLL X)) y: ((PLAYER Y) - (SCROLL Y))\nset size to (100) %\n\ndefine UPDATE CHECKPOINTS (checkpoint length)\nif <touching (checkpoints v)?> then\n    delete all of [respawn x v]\n    delete all of [respawn y v]\n    add (PLAYER X) to [respawn x v]\n    add (PLAYER Y) to [respawn y v]\nend\n\nwhen I receive [respawn v]\nif <(CLONE ID) = [1]> then\n    start sound [Crunch v]\n    hide\n    delete all of [cam pos at death v]\n    add (SCROLL X) to [cam pos at death v]\n    add (SCROLL Y) to [cam pos at death v]\n    set [state v] to [respawn]\n    set [player x v] to (item ([ceiling v] of ((length of [respawn x v]) / (2)) ) of [respawn x v])\n    set [player y v] to (item ([ceiling v] of ((length of [respawn y v]) / (2)) ) of [respawn y v])\n    set [xv v] to [0]\n    set [yv v] to [0]\n    SCROLL BACK TO RESPAWN POINT_ SPEED: [15] [80]\n    set [scroll x v] to (item ([ceiling v] of ((length of [respawn x v]) / (2)) ) of [respawn x v])\n    set [scroll y v] to (item ([ceiling v] of ((length of [respawn y v]) / (2)) ) of [respawn y v])\n    set [state v] to [game]\n    repeat (4)\n        repeat (10)\n            change [ghost v] effect by (7)\n        end\n        repeat (10)\n            change [ghost v] effect by (-7)\n        end\n    end\n    clear graphic effects\nend\n\ndefine RESPAWN ANIMATION (length)\nrepeat (length)\n    change [scroll x v] by (((item ([ceiling v] of ((length of [respawn x v]) / (2)) ) of [respawn x v]) - (item (1) of [cam pos at death v])) / (length))\n    change [scroll y v] by (((item ([ceiling v] of ((length of [respawn y v]) / (2)) ) of [respawn y v]) - (item (2) of [cam pos at death v])) / (length))\n    CHECK POSITION\n    broadcast (SCROLL v)\nend\n\nwhen [0 v] key pressed\n\ndefine MOVE CAMERA (speed)\nchange [scroll x v] by ((<key (right arrow v) pressed?> - <key (left arrow v) pressed?>) * (speed))\nchange [scroll y v] by ((<key (up arrow v) pressed?> - <key (down arrow v) pressed?>) * (speed))\nCHECK POSITION\nbroadcast (SCROLL v)\n\ndefine SCROLL BACK TO RESPAWN POINT_ SPEED: (speed) (max)\nif <(round (([abs v] of ((item ([ceiling v] of ((length of [respawn x v]) / (2)) ) of [respawn x v]) - (SCROLL X)) ) / (speed))) > (max)> then\n    RESPAWN ANIMATION (max)\nelse\n    RESPAWN ANIMATION (round (([abs v] of ((item ([ceiling v] of ((length of [respawn x v]) / (2)) ) of [respawn x v]) - (SCROLL X)) ) / (speed)))\nend\n\nset [yv v] to [100]\n\nset [player x v] to (SCROLL X)\nset [player y v] to (SCROLL Y)\n\nset [scroll x v] to (PLAYER X)\nset [scroll y v] to (PLAYER Y)\n\nwhen I start as a clone\nif <(CLONE ID) = [1]> then\n    RESET AT X: [0] Y: [0]\n    set [state v] to [game]\n    forever\n        if <(STATE) = [game]> then\n            PLAY: GRAVITY: [-1] JUMP HEIGHT: [12] SPEED: [3] SLOPE: [8]\n            show\n        else\n            hide\n            if <(STATE) = [camera]> then\n                MOVE CAMERA [25]\n            end\n        end\n    end\nend\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\n\nwhen I receive [del clones v]\nhide\ndelete this clone\n\nbroadcast (START v)\n\nwhen I receive [end v]\nrepeat (10)\n    change volume by (-10)\nend\n\nif <(CLONE ID) = [1]> then\n    if <(STATE) = [camera]> then\n        set [state v] to [game]\n        RESET AT X: (SCROLL X) Y: (SCROLL Y)\n    else\n        if <(STATE) = [game]> then\n            set [state v] to [camera]\n        end\n    end\nend\n\n@GROUND\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [start v]\nCREATE CLONES\n\nwhen I receive [scroll v]\nif <(CLONE ID) = [1]> then\n    LOOP TILES AT X: ((TILE X) - (SCROLL X)) Y: ((TILE Y) - (SCROLL Y))\n    set size to (200) %\n    go to x: ((TILE X) - (SCROLL X)) y: ((TILE Y) - (SCROLL Y))\n    set size to (100) %\nend\n\ndefine CREATE CLONES\nset [clone id v] to [1]\nCREATE TILES\n\ndefine CREATE TILES\nset [tile x v] to [0]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\nset [tile x v] to [480]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\nset [tile x v] to [480]\nset [tile y v] to [360]\ncreate clone of (_myself_ v)\nset [tile x v] to [0]\nset [tile y v] to [360]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(CLONE ID) = [1]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\nif <(CLONE ID) = [2]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\n\ndefine SWITCH TO RIGHT COSTUME\nswitch costume to (join (join (CLONE ID) [-]) (join (join ((TILE X) / (480)) [-]) ((TILE Y) / (360))))\nif <not <(costume [name v]) = (join (join (CLONE ID) [-]) (join (join ((TILE X) / (480)) [-]) ((TILE Y) / (360))))>> then\n    switch costume to (blank v)\nend\n\ndefine LOOP TILES AT X: (x) Y: (y)\nif <(x) > [480]> then\n    change [tile x v] by (-960)\n    SWITCH TO RIGHT COSTUME\nend\nif <[-480] > (x)> then\n    change [tile x v] by (960)\n    SWITCH TO RIGHT COSTUME\nend\nif <(y) > [360]> then\n    change [tile y v] by (-720)\n    SWITCH TO RIGHT COSTUME\nend\nif <[-360] > (y)> then\n    change [tile y v] by (720)\n    SWITCH TO RIGHT COSTUME\nend\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\n\nwhen I receive [del clones v]\nhide\ndelete this clone\n\n@BACKGROUND 1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [start v]\nCREATE CLONES\n\nwhen I receive [scroll v]\nif <(CLONE ID) = [1]> then\n    GO TO X: ((TILE X) - ((SCROLL X) * (.6))) Y: (() - ((SCROLL Y) * (.6)))\nend\n\ndefine CREATE CLONES\nset [clone id v] to [1]\nCREATE TILES\n\ndefine CREATE TILES\nset [tile x v] to [0]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\nset [tile x v] to [480]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(CLONE ID) = [1]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\nif <(CLONE ID) = [2]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\n\ndefine SWITCH TO RIGHT COSTUME\nif <(pick random (1) to (12)) = [1]> then\n    switch costume to (1-1-0 v)\nelse\n    if <(pick random (1) to (10)) = [1]> then\n        switch costume to (1-2-0 v)\n    else\n        if <(pick random (1) to (8)) = [1]> then\n            switch costume to (1-3-0 v)\n        else\n            switch costume to (1-0-0 v)\n        end\n    end\nend\n\ndefine LOOP TILES AT X: (x) Y: (y)\nif <(x) > [480]> then\n    change [tile x v] by (-960)\n    SWITCH TO RIGHT COSTUME\nend\nif <[-480] > (x)> then\n    change [tile x v] by (960)\n    SWITCH TO RIGHT COSTUME\nend\n\ndefine GO TO X: (x) Y: (y)\nLOOP TILES AT X: (x) Y: (y)\nset size to (200) %\ngo to x: (x) y: (y)\nset size to (100) %\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\n\nwhen I receive [del clones v]\nhide\ndelete this clone\n\n@BACKGROUND 2\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [start v]\nCREATE CLONES\n\nwhen I receive [scroll v]\nif <(CLONE ID) = [1]> then\n    GO TO X: ((TILE X) - ((SCROLL X) * (.3))) Y: ((TILE Y) - ((SCROLL Y) * (.3)))\nend\n\ndefine CREATE CLONES\nset [clone id v] to [1]\nCREATE TILES\n\ndefine CREATE TILES\nset [tile x v] to [0]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\nset [tile x v] to [480]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\nset [tile x v] to [0]\nset [tile y v] to [360]\ncreate clone of (_myself_ v)\nset [tile x v] to [480]\nset [tile y v] to [360]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(CLONE ID) = [1]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\nif <(CLONE ID) = [2]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\n\ndefine SWITCH TO RIGHT COSTUME\nif <((TILE Y) / (360)) = [0]> then\n    switch costume to (1-0-0 v)\nelse\n    switch costume to (blank v)\nend\n\ndefine LOOP TILES AT X: (x) Y: (y)\nif <(x) > [480]> then\n    change [tile x v] by (-960)\n    SWITCH TO RIGHT COSTUME\nend\nif <[-480] > (x)> then\n    change [tile x v] by (960)\n    SWITCH TO RIGHT COSTUME\nend\nif <(y) > [360]> then\n    change [tile y v] by (-720)\n    SWITCH TO RIGHT COSTUME\nend\nif <[-360] > (y)> then\n    change [tile y v] by (720)\n    SWITCH TO RIGHT COSTUME\nend\n\ndefine GO TO X: (x) Y: (y)\nLOOP TILES AT X: (x) Y: (y)\nset size to (200) %\ngo to x: (x) y: (y)\nset size to (100) %\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\n\nwhen I receive [del clones v]\nhide\ndelete this clone\n\n@SPIKES\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [start v]\nCREATE CLONES\n\nwhen I receive [scroll v]\nif <(CLONE ID) = [1]> then\n    LOOP TILES AT X: ((TILE X) - (SCROLL X)) Y: ((TILE Y) - (SCROLL Y))\n    set size to (200) %\n    go to x: ((TILE X) - (SCROLL X)) y: ((TILE Y) - (SCROLL Y))\n    set size to (100) %\nend\n\ndefine CREATE CLONES\nset [clone id v] to [1]\nCREATE TILES\n\ndefine CREATE TILES\nset [tile x v] to [0]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\nset [tile x v] to [480]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\nset [tile x v] to [480]\nset [tile y v] to [360]\ncreate clone of (_myself_ v)\nset [tile x v] to [0]\nset [tile y v] to [360]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(CLONE ID) = [1]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\nif <(CLONE ID) = [2]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\n\ndefine SWITCH TO RIGHT COSTUME\nswitch costume to (join (join (CLONE ID) [-]) (join (join ((TILE X) / (480)) [-]) ((TILE Y) / (360))))\nif <not <(costume [name v]) = (join (join (CLONE ID) [-]) (join (join ((TILE X) / (480)) [-]) ((TILE Y) / (360))))>> then\n    switch costume to (blank v)\nend\n\ndefine LOOP TILES AT X: (x) Y: (y)\nif <(x) > [480]> then\n    change [tile x v] by (-960)\n    SWITCH TO RIGHT COSTUME\nend\nif <[-480] > (x)> then\n    change [tile x v] by (960)\n    SWITCH TO RIGHT COSTUME\nend\nif <(y) > [360]> then\n    change [tile y v] by (-720)\n    SWITCH TO RIGHT COSTUME\nend\nif <[-360] > (y)> then\n    change [tile y v] by (720)\n    SWITCH TO RIGHT COSTUME\nend\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\n\nwhen I receive [del clones v]\nhide\ndelete this clone\n\n@CHECKPOINTS\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [start v]\nCREATE CLONES\n\nwhen I receive [scroll v]\nif <(CLONE ID) = [1]> then\n    LOOP TILES AT X: ((TILE X) - (SCROLL X)) Y: ((TILE Y) - (SCROLL Y))\n    set size to (200) %\n    go to x: ((TILE X) - (SCROLL X)) y: ((TILE Y) - (SCROLL Y))\n    set size to (100) %\n    if <(STATE) = [camera]> then\n        set [ghost v] effect to (80)\n    else\n        set [ghost v] effect to (100)\n    end\nend\n\ndefine CREATE CLONES\nset [clone id v] to [1]\nCREATE TILES\n\ndefine CREATE TILES\nset [tile x v] to [0]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\nset [tile x v] to [480]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\nset [tile x v] to [480]\nset [tile y v] to [360]\ncreate clone of (_myself_ v)\nset [tile x v] to [0]\nset [tile y v] to [360]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(CLONE ID) = [1]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\nif <(CLONE ID) = [2]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\n\ndefine SWITCH TO RIGHT COSTUME\nswitch costume to (join (join (CLONE ID) [-]) (join (join ((TILE X) / (480)) [-]) ((TILE Y) / (360))))\nif <not <(costume [name v]) = (join (join (CLONE ID) [-]) (join (join ((TILE X) / (480)) [-]) ((TILE Y) / (360))))>> then\n    switch costume to (blank v)\nend\n\ndefine LOOP TILES AT X: (x) Y: (y)\nif <(x) > [480]> then\n    change [tile x v] by (-960)\n    SWITCH TO RIGHT COSTUME\nend\nif <[-480] > (x)> then\n    change [tile x v] by (960)\n    SWITCH TO RIGHT COSTUME\nend\nif <(y) > [360]> then\n    change [tile y v] by (-720)\n    SWITCH TO RIGHT COSTUME\nend\nif <[-360] > (y)> then\n    change [tile y v] by (720)\n    SWITCH TO RIGHT COSTUME\nend\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\n\nwhen I receive [del clones v]\nhide\ndelete this clone\n\n@BACK\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [start v]\nCREATE CLONES\n\nwhen I receive [scroll v]\nif <(CLONE ID) = [1]> then\n    LOOP TILES AT X: ((TILE X) - (SCROLL X)) Y: ((TILE Y) - (SCROLL Y))\n    set size to (200) %\n    go to x: ((TILE X) - (SCROLL X)) y: ((TILE Y) - (SCROLL Y))\n    set size to (100) %\nend\n\ndefine CREATE CLONES\nset [clone id v] to [1]\nCREATE TILES\n\ndefine CREATE TILES\nset [tile x v] to [0]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\nset [tile x v] to [480]\nset [tile y v] to [0]\ncreate clone of (_myself_ v)\nset [tile x v] to [480]\nset [tile y v] to [360]\ncreate clone of (_myself_ v)\nset [tile x v] to [0]\nset [tile y v] to [360]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(CLONE ID) = [1]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\nif <(CLONE ID) = [2]> then\n    SWITCH TO RIGHT COSTUME\n    show\nend\n\ndefine SWITCH TO RIGHT COSTUME\nswitch costume to (join (join (CLONE ID) [-]) (join (join ((TILE X) / (480)) [-]) ((TILE Y) / (360))))\nif <not <(costume [name v]) = (join (join (CLONE ID) [-]) (join (join ((TILE X) / (480)) [-]) ((TILE Y) / (360))))>> then\n    switch costume to (blank v)\nend\n\ndefine LOOP TILES AT X: (x) Y: (y)\nif <(x) > [480]> then\n    change [tile x v] by (-960)\n    SWITCH TO RIGHT COSTUME\nend\nif <[-480] > (x)> then\n    change [tile x v] by (960)\n    SWITCH TO RIGHT COSTUME\nend\nif <(y) > [360]> then\n    change [tile y v] by (-720)\n    SWITCH TO RIGHT COSTUME\nend\nif <[-360] > (y)> then\n    change [tile y v] by (720)\n    SWITCH TO RIGHT COSTUME\nend\n\nwhen I receive [end v]\nstop [other scripts in sprite v]\n\nwhen I receive [del clones v]\nhide\ndelete this clone\n\n@CUTSCENES\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nbroadcast (DEL CLONES v)\nset [clone id v] to [3]\ncreate clone of (_myself_ v)\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\n\nwhen I receive [beginning v]\nswitch costume to (start 1 v)\nset [clone id v] to [2]\ncreate clone of (_myself_ v)\nswitch costume to (costume1 v)\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(CLONE ID) = [1]> then\n    show\n    clear graphic effects\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\n    wait (6) seconds\n    repeat (20)\n        change [ghost v] effect by (-5)\n    end\n    broadcast (START v)\nend\nif <(CLONE ID) = [2]> then\n    show\n    clear graphic effects\n    wait (2) seconds\n    next costume\n    wait (1) seconds\n    start sound [Rip v]\n    next costume\n    wait (2) seconds\nend\nif <(CLONE ID) = [3]> then\n    switch costume to (end 1 v)\n    show\n    clear graphic effects\n    wait (2) seconds\n    next costume\n    wait (1) seconds\n    start sound [Rip v]\n    next costume\n    wait (1) seconds\n    repeat (2)\n        next costume\n        wait (0) seconds\n    end\n    start sound [Drum Boing v]\n    wait (1) seconds\n    next costume\n    wait (1) seconds\n    next costume\n    wait (2) seconds\n    broadcast (DELETE END v)\nend\n\nwhen I receive [start v]\ndelete this clone\n\nwhen I receive [delete end v]\nhide\ndelete this clone\n\n
Use the arrow keys to move and get to the other side of each level.\n\nLower score is better!