Infinite Platformer

Instructions: Arrow keys or WASD to move around (like any platformer), m to mute, and space to show/hide score.\n\nPRESS R IF THE LEVEL IS NOT POSSIBLE\ntho most the time it is\n\nplease love and fave and follow if you like it (^-^)\n\nthe levels randomly generate every time (the levels are pen, the player is not)\n\nthe platforming is a liiiiitle bit glitchy but not noticeable unless u r moving very slowly :)

@Stage\n\nwhen flag clicked\nset volume to (50) %\nforever\n    play sound [Elektronomia - Sky High \[NCS Release\].mp3 v] until done\nend\n\nwhen flag clicked\nforever\n    if <key (m v) pressed?> then\n        wait until <not <key (m v) pressed?>>\n        if <(volume) = [50]> then\n            set volume to (0) %\n            set [volume v] to [0]\n        else\n            set volume to (50) %\n            set [volume v] to [50]\n        end\n    end\nend\n\nwhen flag clicked\nhide variable [level v]\nforever\n    if <key (space v) pressed?> then\n        wait until <not <key (space v) pressed?>>\n        if <(on) = [1]> then\n            hide variable [level v]\n            set [on v] to [0]\n        else\n            show variable [level v]\n            set [on v] to [1]\n        end\n    end\nend\n\n@Pen Level Generator\n\nwhen flag clicked\ndelete all of [blank stack chances v]\ndelete all of [red stack chances v]\ndelete all of [ground y positions v]\nshow list [red stack chances v]\nshow list [ground y positions v]\nshow list [repeat chance v]\nshow list [blank stack chances v]\nset [chances of red v] to [4]\nset [chances of gaps v] to [7]\nhide variable [chances of red v]\nhide variable [chances of gaps v]\nerase all\nbroadcast (Generate Level v)\n\ndefine Render Ground\ngo to x: (-240) y: (item (1) of [ground y positions v])\nRender Stack (B)\nif <not <(item (1) of [repeat chance v]) = [1]>> then\n    set y to (item (2) of [ground y positions v])\nelse\n    set y to (item (1) of [ground y positions v])\nend\nchange x by (30)\nRender Stack (B)\nif <not <(item (2) of [repeat chance v]) = [1]>> then\n    set y to (item (3) of [ground y positions v])\nelse\n    set y to (item (2) of [ground y positions v])\nend\nchange x by (30)\nif <(item (1) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (1) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (3) of [repeat chance v]) = [1]>> then\n    set y to (item (4) of [ground y positions v])\nelse\n    set y to (item (3) of [ground y positions v])\nend\nchange x by (30)\nif <(item (2) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (2) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (4) of [repeat chance v]) = [1]>> then\n    set y to (item (5) of [ground y positions v])\nelse\n    set y to (item (4) of [ground y positions v])\nend\nchange x by (30)\nif <(item (3) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (3) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (5) of [repeat chance v]) = [1]>> then\n    set y to (item (6) of [ground y positions v])\nelse\n    set y to (item (5) of [ground y positions v])\nend\nchange x by (30)\nif <(item (4) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (4) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (6) of [repeat chance v]) = [1]>> then\n    set y to (item (7) of [ground y positions v])\nelse\n    set y to (item (6) of [ground y positions v])\nend\nchange x by (30)\nif <(item (5) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (5) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (7) of [repeat chance v]) = [1]>> then\n    set y to (item (8) of [ground y positions v])\nelse\n    set y to (item (7) of [ground y positions v])\nend\nchange x by (30)\nif <(item (6) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (6) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (8) of [repeat chance v]) = [1]>> then\n    set y to (item (9) of [ground y positions v])\nelse\n    set y to (item (8) of [ground y positions v])\nend\nchange x by (30)\nif <(item (7) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (7) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (9) of [repeat chance v]) = [1]>> then\n    set y to (item (10) of [ground y positions v])\nelse\n    set y to (item (9) of [ground y positions v])\nend\nchange x by (30)\nif <(item (8) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (8) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (10) of [repeat chance v]) = [1]>> then\n    set y to (item (11) of [ground y positions v])\nelse\n    set y to (item (10) of [ground y positions v])\nend\nchange x by (30)\nif <(item (9) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (9) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (11) of [repeat chance v]) = [1]>> then\n    set y to (item (12) of [ground y positions v])\nelse\n    set y to (item (11) of [ground y positions v])\nend\nchange x by (30)\nif <(item (10) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (10) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (12) of [repeat chance v]) = [1]>> then\n    set y to (item (13) of [ground y positions v])\nelse\n    set y to (item (12) of [ground y positions v])\nend\nchange x by (30)\nif <(item (11) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (11) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (13) of [repeat chance v]) = [1]>> then\n    set y to (item (14) of [ground y positions v])\nelse\n    set y to (item (13) of [ground y positions v])\nend\nchange x by (30)\nif <(item (12) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (12) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (14) of [repeat chance v]) = [1]>> then\n    set y to (item (15) of [ground y positions v])\nelse\n    set y to (item (14) of [ground y positions v])\nend\nchange x by (30)\nif <(item (13) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (13) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\nif <not <(item (15) of [repeat chance v]) = [1]>> then\n    set y to (item (16) of [ground y positions v])\nelse\n    set y to (item (15) of [ground y positions v])\nend\nchange x by (30)\nif <(item (14) of [red stack chances v]) = [1]> then\n    Render Stack (R)\nelse\n    if <not <(item (14) of [blank stack chances v]) = [1]>> then\n        Render Stack (B)\n    end\nend\n\ndefine Render (B) Block\nset pen color to (#000000)\nset pen size to (6)\npen down\nchange x by (30)\nchange y by (-30)\nchange x by (-30)\nchange y by (30)\nchange y by (-5)\nchange x by (30)\nchange y by (-5)\nchange x by (-30)\nchange y by (-5)\nchange x by (30)\nchange y by (-5)\nchange x by (-30)\nchange y by (-5)\nchange x by (30)\nchange y by (25)\nchange x by (-30)\npen up\n\ndefine Render (R) Block\nset pen color to (#ff0000)\nset pen size to (6)\npen down\nchange x by (30)\nchange y by (-30)\nchange x by (-30)\nchange y by (30)\nchange y by (-5)\nchange x by (30)\nchange y by (-5)\nchange x by (-30)\nchange y by (-5)\nchange x by (30)\nchange y by (-5)\nchange x by (-30)\nchange y by (-5)\nchange x by (30)\nchange y by (25)\nchange x by (-30)\npen up\n\ndefine Render Stack (B)\nRender (B) Block\nchange y by (-30)\nRender (B) Block\nchange y by (-30)\nRender (B) Block\nchange y by (-30)\nRender (B) Block\nchange y by (-30)\nRender (B) Block\nchange y by (-30)\nRender (B) Block\nchange y by (-30)\nRender (B) Block\nchange y by (-30)\nRender (B) Block\nchange y by (-30)\nRender (B) Block\n\nwhen I receive [generate level v]\ndelete all of [blank stack chances v]\ndelete all of [ground y positions v]\ndelete all of [red stack chances v]\ndelete all of [repeat chance v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (-170) to (-20)) to [ground y positions v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of red)) to [red stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (chances of gaps)) to [blank stack chances v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nadd (pick random (1) to (3)) to [repeat chance v]\nerase all\nRender Ground\n\ndefine Render Stack (R)\nRender (R) Block\nchange y by (-30)\nRender (R) Block\nchange y by (-30)\nRender (R) Block\nchange y by (-30)\nRender (R) Block\nchange y by (-30)\nRender (R) Block\nchange y by (-30)\nRender (R) Block\nchange y by (-30)\nRender (R) Block\nchange y by (-30)\nRender (R) Block\nchange y by (-30)\nRender (R) Block\n\nwhen [r v] key pressed\nbroadcast (Generate Level v)\n\n@Player\n\nwhen flag clicked\ngo to x: (-220) y: (0)\nshow\nset [level v] to [1]\nset [x v] to [0]\nset [y v] to [0]\nforever\n    go to [front v] layer\n    show\n    change [y v] by (-1)\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [x v] by (-1)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [x v] by (1)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching color (#000000)?> then\n        change y by (5)\n    end\n    if <touching color (#000000)?> then\n        change y by (-4)\n        change x by ((x) * (-1))\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [y v] to [9]\n            if <([abs v] of (x) ) = (x)> then\n                set [x v] to [-7]\n            else\n                set [x v] to [7]\n            end\n        else\n            set [x v] to [0]\n        end\n    end\n    change y by (y)\n    if <touching color (#000000)?> then\n        change y by ((y) - ((y) * (2)))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <touching color (#000000)?>> then\n        set [y v] to [11]\n    end\n    change y by (1)\n    if <<(x position) = [240]> or <(x position) > [235]>> then\n        go to x: (-220) y: (0)\n        change [level v] by (1)\n        broadcast (Generate Level v)\n    end\n    if <<(y position) < [-175]> or <touching color (#ff0000)?>> then\n        go to x: (-220) y: (0)\n    end\nend\n\nwhen [r v] key pressed\ngo to x: (-220) y: (0)\n\n@Screenshot 2020-03-04 at 19\n\nwhen flag clicked\nhide\n\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\n