Looped || an endless platformer ∞

Instructions: Arrow keys or WASD or mobile controls to move. \nIf a level is impossible or too difficult, press 's' to skip.\nPress 'r' to restart.\nAvoid spikes and bounce on springs :)\nPress space to switch the backdrop\n

@Stage\n\nwhen [space v] key pressed\nnext backdrop\n\nwhen [s v] key pressed\nset [exit v] to [skip]\n\nwhen [r v] key pressed\nbroadcast (reset v)\n\nwhen I receive [play game v]\nforever\n    play sound [Inferno v] until done\n    play sound [Unlimited v] until done\nend\n\n@blank\n\n@Player\n\nwhen flag clicked\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (Setup v) and wait\n    setup\n    repeat until <(EXIT) > []>\n        loop\n        broadcast (Loop v) and wait\n    end\n    if <(EXIT) = [next]> then\n        change [level v] by (1)\n        hide\n        broadcast (NEXT LEVEL v) and wait\n    end\n    if <(EXIT) = [skip]> then\n        hide\n        broadcast (NEXT LEVEL v) and wait\n    end\n    set [exit v] to []\nend\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\ndefine setup\nset [in air v] to [0]\nset [x v v] to [0]\nset [y v v] to [0]\ngo to x: (-180) y: ([y position v] of [platform 1 v])\nshow\n\ndefine loop\nif <<key (left arrow v) pressed?> or <<<mouse down?> and <((mouse x) - (20)) < [0]>> or <key (a v) pressed?>>> then\n    change [x v v] by (-2)\nend\nif <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <((mouse x) + (20)) > [0]>>>> then\n    change [x v v] by (2)\nend\nset [x v v] to ((x v) * (0.8))\nif <([abs v] of (x v) ) > [0.9]> then\n    change player x by (round (x v))\nend\nif <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <((mouse y) - (30)) > [0]>>>> then\n    if <(in air) < [4]> then\n        set [y v v] to [15]\n    end\nend\nchange [y v v] by (-2)\nchange player y by (y v)\nif <(x position) > [239]> then\n    set [exit v] to [next]\nend\nif <(y position) < [-179]> then\n    set [exit v] to [die]\nend\nif <<touching (spikes v)?> or <touching (spikes2 v)?>> then\n    set [exit v] to [die]\nend\nif <touching (spring v)?> then\n    if <([costume # v] of [spring v]) = [1]> then\n        set [y v v] to [27]\n    else\n        if <([costume # v] of [spring v]) = [2]> then\n            set [y v v] to [-8]\n        else\n            set [x v v] to [-27]\n        end\n    end\nend\n\ndefine change player x by (x v)\nchange x by (x v)\nif <<touching (platform 1 v)?> or <<touching (platform 2 v)?> or <<touching (platform 3 v)?> or <touching (platform 4 v)?>>>> then\n    repeat (10)\n        change y by (1)\n        if <not <<touching (platform 1 v)?> or <<touching (platform 2 v)?> or <<touching (platform 3 v)?> or <touching (platform 4 v)?>>>>> then\n            stop [this script v]\n        end\n    end\n    change y by (-10)\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <((mouse y) - (30)) > [0]>>>> then\n        if <(x v) > [0]> then\n            set [x v v] to [-16]\n        else\n            set [x v v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [x v v] to [0]\n    end\n    repeat until <not <<touching (platform 1 v)?> or <<touching (platform 2 v)?> or <<touching (platform 3 v)?> or <touching (platform 4 v)?>>>>>\n        if <(x v) > [0]> then\n            change x by (-1)\n        else\n            change x by (1)\n        end\n    end\nend\n\ndefine change player y by (y v)\nchange y by (y v)\nchange [in air v] by (1)\nrepeat until <not <<touching (platform 1 v)?> or <<touching (platform 2 v)?> or <<touching (platform 3 v)?> or <touching (platform 4 v)?>>>>>\n    if <(y v) > [0]> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [in air v] to [0]\n    end\n    set [y v v] to [0]\nend\n\nwhen I receive [reset v]\nsetup\n\n@platform 1\n\nwhen I receive [next level v]\nset y to (pick random (-100) to (130))\nset [color v] effect to (pick random (0) to (200))\n\n@platform 2\n\nwhen I receive [next level v]\nhide\nset y to (pick random (-100) to (130))\nset [color v] effect to (pick random (0) to (200))\nswitch costume to (pick random (1) to (7))\nif <(costume [name v]) = [costume5]> then\n    set y to (([abs v] of ([y position v] of [platform 1 v]) ) + (pick random (-60) to (30)))\nend\nif <(costume [number v]) = [3]> then\n    set y to (([y position v] of [platform 1 v]) + (pick random (150) to (170)))\nend\nif <<<(costume [number v]) = [4]> and <([costume # v] of [platform 3 v]) = [3]>> and <(spikes 2) = [1]>> then\n    switch costume to (pick random (1) to (3))\nend\nif <(pick random (1) to (2)) = [1]> then\n    broadcast (Spikes v) and wait\nelse\n    if <(pick random (1) to (3)) = [1]> then\n        broadcast (spring v) and wait\n    end\nend\nshow\n\nif <(y position) > [60]> then\n    hide\nend\n\n@platform 3\n\nwhen I receive [next level v]\nset [color v] effect to (pick random (0) to (200))\nswitch costume to (pick random (1) to (8))\nif <([costume name v] of [platform 2 v]) = [costume5]> then\n    set y to (pick random (-100) to (50))\nelse\n    if <<([costume name v] of [platform 2 v]) = [costume3]> and <([y position v] of [platform 2 v]) > [150]>> then\n        set y to (([y position v] of [platform 2 v]) - (pick random (160) to (210)))\n    else\n        set y to (pick random (-100) to (130))\n    end\nend\nif <<(costume [number v]) = [6]> and <([costume # v] of [platform 2 v]) = [3]>> then\n    switch costume to (pick random (1) to (5))\nend\nif <(pick random (1) to (2)) = [1]> then\n    broadcast (Spikes 2 v)\nend\n\n@platform 4\n\nwhen I receive [next level v]\nset y to (pick random (-100) to (130))\nset [color v] effect to (pick random (0) to (200))\nif <([y position v] of [platform 3 v]) < [80]> then\n    if <(pick random (1) to (5)) = [5]> then\n        switch costume to (costume5 v)\n    else\n        switch costume to (pick random (1) to (4))\n    end\nelse\n    switch costume to (pick random (1) to (4))\nend\n\n@Spikes\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [spikes v]\nset [spikes v] to [1]\nif <([costume # v] of [platform 2 v]) = [6]> then\n    if <(pick random (1) to (2)) = [1]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume6 v)\n    end\n    set x to (-40)\n    set y to (([y position v] of [platform 2 v]) - (80))\n    show\nelse\n    if <([costume # v] of [platform 2 v]) = [2]> then\n        if <(pick random (1) to (2)) = [1]> then\n            switch costume to (costume2 v)\n        else\n            switch costume to (costume5 v)\n        end\n        set x to (3)\n        set y to ([y position v] of [platform 2 v])\n        show\n    else\n        if <([costume # v] of [platform 2 v]) = [1]> then\n            if <(pick random (1) to (2)) = [1]> then\n                switch costume to (costume3 v)\n            else\n                switch costume to (costume7 v)\n            end\n            set x to (0)\n            set y to ([y position v] of [platform 2 v])\n            show\n        else\n            if <([costume # v] of [platform 2 v]) = [3]> then\n                switch costume to (costume4 v)\n                set x to (0)\n                set y to ([y position v] of [platform 2 v])\n                show\n            else\n                if <([costume # v] of [platform 2 v]) = [7]> then\n                    if <(pick random (1) to (2)) = [1]> then\n                        switch costume to (costume8 v)\n                    else\n                        switch costume to (costume9 v)\n                    end\n                    set x to (0)\n                    set y to ([y position v] of [platform 2 v])\n                    show\n                else\n                    if <([costume # v] of [platform 2 v]) = [5]> then\n                        switch costume to (costume10 v)\n                        set x to (0)\n                        set y to ([y position v] of [platform 2 v])\n                        show\n                    else\n                        hide\n                    end\n                end\n            end\n        end\n    end\nend\nif <touching (_edge_ v)?> then\n    hide\nend\n\nwhen I receive [next level v]\nset [spikes v] to [0]\nhide\n\n@Spikes2\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [spikes v]\nset [spikes 2 v] to [1]\nif <([costume # v] of [platform 3 v]) = [2]> then\n    if <(pick random (1) to (2)) = [2]> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume7 v)\n    end\n    set x to (0)\n    set y to ([y position v] of [platform 3 v])\n    show\nelse\n    if <([costume # v] of [platform 3 v]) = [5]> then\n        switch costume to (costume2 v)\n        set x to (0)\n        set y to ([y position v] of [platform 3 v])\n        show\n    else\n        if <([costume # v] of [platform 3 v]) = [3]> then\n            switch costume to (costume3 v)\n            set x to (0)\n            set y to ([y position v] of [platform 3 v])\n            show\n        else\n            if <([costume # v] of [platform 3 v]) = [1]> then\n                if <(pick random (1) to (2)) = [1]> then\n                    switch costume to (costume4 v)\n                else\n                    switch costume to (costume8 v)\n                end\n                set x to (0)\n                set y to ([y position v] of [platform 3 v])\n                show\n            else\n                if <([costume # v] of [platform 3 v]) = [4]> then\n                    if <(pick random (1) to (2)) = [1]> then\n                        switch costume to (costume5 v)\n                    else\n                        switch costume to (costume6 v)\n                    end\n                    set x to (0)\n                    set y to ([y position v] of [platform 3 v])\n                    show\n                else\n                    if <([costume # v] of [platform 3 v]) = [7]> then\n                        switch costume to (costume9 v)\n                        set x to (0)\n                        set y to ([y position v] of [platform 3 v])\n                        show\n                    else\n                        if <([costume # v] of [platform 3 v]) = [8]> then\n                            if <(pick random (1) to (2)) = [1]> then\n                                switch costume to (costume10 v)\n                            else\n                                switch costume to (costume11 v)\n                            end\n                            set x to (0)\n                            set y to ([y position v] of [platform 3 v])\n                            show\n                        else\n                            hide\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [next level v]\nhide\nset [spikes 2 v] to [0]\n\n@Level\n\nwhen I receive [green flag v]\ngo to x: (-140) y: (160)\nhide\nswitch costume to (costume10 v)\nset [brightness v] effect to (0)\nswitch backdrop to (backdrop2 v)\nset [numeral v] to [0]\n\nwhen I receive [play game v]\ngo to [front v] layer\nrepeat (6)\n    create clone of (_myself_ v)\n    change [numeral v] by (1)\n    change x by (-15)\nend\n\nwhen I start as a clone\nshow\ngo to [front v] layer\n\nwhen I receive [loop v]\nswitch costume to (letter ((length of (LEVEL)) - (numeral)) of (LEVEL))\n\nwhen backdrop switches to [backdrop1 v]\nset [brightness v] effect to (-100)\n\nwhen backdrop switches to [backdrop2 v]\nset [brightness v] effect to (0)\n\n@Spring\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [next level v]\nhide\nswitch costume to (costume1 v)\nset [color v] effect to (pick random (0) to (200))\n\nwhen I receive [spring v]\nif <([costume # v] of [platform 2 v]) = [1]> then\n    set x to (-59)\n    set y to (([y position v] of [platform 2 v]) - (40))\n    show\nelse\n    if <([costume # v] of [platform 2 v]) = [6]> then\n        if <(pick random (1) to (2)) = [1]> then\n            switch costume to (costume1 v)\n            set x to (-73)\n            set y to (([y position v] of [platform 2 v]) - (115))\n        else\n            switch costume to (costume3 v)\n            set x to (-41)\n            set y to (([y position v] of [platform 2 v]) - (85))\n        end\n        show\n    else\n        if <([costume # v] of [platform 3 v]) = [1]> then\n            set x to (61)\n            set y to (([y position v] of [platform 3 v]) - (40))\n            show\n        else\n            if <([costume # v] of [platform 3 v]) = [2]> then\n                set x to (92)\n                set y to (([y position v] of [platform 3 v]) - (40))\n                show\n            else\n                if <([costume # v] of [platform 2 v]) = [7]> then\n                    set x to (-58)\n                    set y to (([y position v] of [platform 2 v]) - (40))\n                    show\n                else\n                    if <([costume # v] of [platform 3 v]) = [4]> then\n                        set x to (64)\n                        set y to (([y position v] of [platform 3 v]) - (28))\n                        show\n                    else\n                        if <([costume # v] of [platform 2 v]) = [5]> then\n                            switch costume to (costume2 v)\n                            set x to (-55)\n                            set y to (([y position v] of [platform 2 v]) + (72))\n                            show\n                        else\n                            if <([costume # v] of [platform 3 v]) = [8]> then\n                                switch costume to (costume3 v)\n                                set x to (30)\n                                set y to (([y position v] of [platform 3 v]) - (116))\n                                show\n                            else\n                                hide\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\nhide\n\nwhen [m v] key pressed\nif <(username) = [MoonVirus]> then\n    show\n    go to [front v] layer\nend\n\n@World Record\n\nwhen I receive [green flag v]\ngo to x: (220) y: (160)\nhide\nset [brightness v] effect to (0)\nswitch backdrop to (backdrop2 v)\nset [numeral v] to [0]\nswitch costume to (costume10 v)\n\nwhen I receive [play game v]\ngo to [front v] layer\nrepeat (6)\n    create clone of (_myself_ v)\n    change [numeral v] by (1)\n    change x by (-15)\nend\n\nwhen I start as a clone\nswitch costume to (costume10 v)\nshow\ngo to [front v] layer\n\nwhen backdrop switches to [backdrop1 v]\nset [brightness v] effect to (-100)\n\nwhen backdrop switches to [backdrop2 v]\nset [brightness v] effect to (0)\n\nwhen I receive [setup v]\nswitch costume to (costume10 v)\nif <(LEVEL) > (☁ World Record)> then\n    set [☁ world record v] to (LEVEL)\nend\nswitch costume to (letter ((length of (☁ World Record)) - (numeral)) of (☁ World Record))\n\n