Scrolling Tiles Platformer
@Stage\n\nwhen flag clicked\nset [width v] to [15]\nset [height v] to [11]\nset [world_width v] to [100]\nset [world_height v] to [100]\nset [scroll x v] to [0]\nset [scroll y v] to ((((WORLD_HEIGHT) - (HEIGHT)) / (2)) + (3))\nbroadcast (init v) and wait\nforever\n    broadcast (update v) and wait\n    set [scroll x v] to (((scroll x) * (0.8)) + ((([x v] of [player v]) - ((WIDTH) / (2))) * (0.2)))\n    if <(scroll x) < [0]> then\n        set [scroll x v] to [0]\n    else\n        if <(scroll x) > ((WORLD_WIDTH) - (WIDTH))> then\n            set [scroll x v] to ((WORLD_WIDTH) - (WIDTH))\n        end\n    end\n    set [scroll y v] to (((scroll y) * (0.8)) + ((([y v] of [player v]) - ((HEIGHT) / (2))) * (0.2)))\n    if <(scroll y) < [0]> then\n        set [scroll y v] to [0]\n    else\n        if <(scroll y) > ((WORLD_HEIGHT) - (HEIGHT))> then\n            set [scroll y v] to ((WORLD_HEIGHT) - (HEIGHT))\n        end\n    end\n    broadcast (scroll v) and wait\nend\n\n@world\n\nwhen I receive [init v]\nhide\ngenerate world\ncreate clones\n\ndefine generate world\ndelete (all) of [world v]\nrepeat ((WORLD_WIDTH) * (WORLD_HEIGHT))\n    add [0] to [world v]\nend\nset [height v] to ((WORLD_HEIGHT) / (2))\nset [delta v] to [0]\nset [x v] to [1]\nrepeat until <(x) > (WORLD_WIDTH)>\n    set [y v] to [1]\n    set [index v] to (x)\n    repeat until <(y) > (height)>\n        if <<(y) < (height)> and <(y) < ((height) - (delta))>> then\n            replace item (index) of [world v] with [1]\n        else\n            replace item (index) of [world v] with [2]\n        end\n        change [index v] by (WORLD_WIDTH)\n        change [y v] by (1)\n    end\n    set [delta v] to (pick random (-2) to (2))\n    if <(delta) < [0]> then\n        set [y v] to ((height) + (delta))\n        change [index v] by (((delta) - (1)) * (WORLD_WIDTH))\n        repeat until <(y) > (height)>\n            replace item (index) of [world v] with [2]\n            change [index v] by (WORLD_WIDTH)\n            change [y v] by (1)\n        end\n    end\n    set [y v] to ((height) + (5))\n    change [index v] by ((WORLD_WIDTH) * (5))\n    repeat until <(y) > (WORLD_HEIGHT)>\n        replace item (index) of [world v] with [3]\n        change [index v] by (WORLD_WIDTH)\n        change [y v] by (1)\n    end\n    change [height v] by (delta)\n    if <(height) < [1]> then\n        set [height v] to [1]\n    end\n    change [x v] by (1)\nend\n\ndefine create clones\nset [id v] to [1]\nset [clone y v] to [1]\nrepeat until <(clone y) > (HEIGHT)>\n    set [clone x v] to [1]\n    repeat until <(clone x) > (WIDTH)>\n        create clone of (_myself_ v)\n        change [clone x v] by (1)\n        change [id v] by (1)\n    end\n    change [clone y v] by (1)\nend\nset [id v] to [0]\n\nwhen I receive [scroll v]\nif <(id) > [0]> then\n    set [x v] to ((clone x) - (([floor v] of (((clone x) - (scroll x)) / (WIDTH)) ) * (WIDTH)))\n    set [y v] to ((clone y) - (([floor v] of (((clone y) - (scroll y)) / (HEIGHT)) ) * (HEIGHT)))\n    set [index v] to (item ((x) + (((y) - (1)) * (WORLD_WIDTH))) of [world v])\n    if <(index) > [0]> then\n        show\n        if <not <(costume [number v]) = (index)>> then\n            switch costume to (index)\n        end\n        set x to ((((x) - (scroll x)) * (32)) - (240))\n        set y to ((((y) - (scroll y)) * (32)) - (180))\n    else\n        hide\n    end\nend\n\n@player\n\nwhen I receive [init v]\nset [x v] to [1]\nset [y v] to (((WORLD_HEIGHT) / (2)) + (3))\nset [x vel v] to [0]\nset [y vel v] to [0]\n\ndefine None\nset [index v] to ((x) + ((([floor v] of (y) ) - (1)) * (WORLD_WIDTH)))\nif <(item (index) of [world v]) > [0]> then\n    set [x v] to (collision)\n    set [x vel v] to [0]\nelse\n    set [index v] to ((x) + ((([ceiling v] of ((y) + (0.5)) ) - (1)) * (WORLD_WIDTH)))\n    if <(item (index) of [world v]) > [0]> then\n        set [x v] to (collision)\n        set [x vel v] to [0]\n    end\nend\n\nwhen I receive [scroll v]\nset x to ((((x) - (scroll x)) * (32)) - (240))\nset y to ((((y) - (scroll y)) * (32)) - (180))\n\nwhen I receive [update v]\nif <(y vel) > [0]> then\n    set [vel v] to (y vel)\n    repeat until <(vel) < [1]>\n        change [y v] by (1)\n        change [vel v] by (-1)\n        check y: ([ceiling v] of ((y) + (0.5)) ) collision: (([ceiling v] of ((y) - (0.5)) ) - (0.5))\n        if <(y vel) = [0]> then\n            set [vel v] to [0]\n        end\n    end\n    change [y v] by (vel)\n    check y: ([ceiling v] of ((y) + (0.5)) ) collision: (([floor v] of ((y) + (0.5)) ) - (0.5))\n    set [ground v] to [0]\nelse\n    if <(y vel) < [0]> then\n        set [vel v] to (y vel)\n        repeat until <(vel) > [-1]>\n            change [y v] by (-1)\n            change [vel v] by (1)\n            check y: ([floor v] of (y) ) collision: ([floor v] of ((y) + (1)) )\n            if <(y vel) = [0]> then\n                set [vel v] to [0]\n            end\n        end\n        change [y v] by (vel)\n        check y: ([floor v] of (y) ) collision: ([ceiling v] of (y) )\n        if <(y vel) = [0]> then\n            set [ground v] to [1]\n        else\n            set [ground v] to [0]\n        end\n    end\nend\nif <(x vel) > [0]> then\n    set [vel v] to (x vel)\n    repeat until <(vel) < [1]>\n        change [x v] by (1)\n        change [vel v] by (-1)\n        check x: ([ceiling v] of (x) ) collision: ([ceiling v] of ((x) - (1)) )\n        if <(x vel) = [0]> then\n            set [vel v] to [0]\n        end\n    end\n    change [x v] by (vel)\n    check x: ([ceiling v] of (x) ) collision: ([floor v] of (x) )\nelse\n    if <(x vel) < [0]> then\n        set [vel v] to (x vel)\n        repeat until <(vel) > [-1]>\n            change [x v] by (-1)\n            change [vel v] by (1)\n            check x: ([floor v] of (x) ) collision: ([floor v] of ((x) + (1)) )\n            if <(x vel) = [0]> then\n                set [vel v] to [0]\n            end\n        end\n        change [x v] by (vel)\n        check x: ([floor v] of (x) ) collision: ([ceiling v] of (x) )\n    end\nend\nif <(x) < [1]> then\n    set [x v] to [1]\n    set [x vel v] to [0]\nelse\n    if <(x) > ((WORLD_WIDTH) - (1))> then\n        set [x v] to ((WORLD_WIDTH) - (1))\n        set [x vel v] to [0]\n    end\nend\nif <key (right arrow v) pressed?> then\n    change [x vel v] by (0.1)\nelse\n    if <key (left arrow v) pressed?> then\n        change [x vel v] by (-0.1)\n    end\nend\nif <(ground) > [0]> then\n    if <key (up arrow v) pressed?> then\n        set [y vel v] to [0.8]\n    end\nend\nset [x vel v] to ((x vel) * (0.8))\nchange [y vel v] by (-0.1)\n\ndefine None\nset [index v] to (([floor v] of ((x) + (0.1)) ) + (((y) - (1)) * (WORLD_WIDTH)))\nif <(item (index) of [world v]) > [0]> then\n    set [y v] to (collision)\n    set [y vel v] to [0]\nelse\n    set [index v] to (([ceiling v] of ((x) - (0.1)) ) + (((y) - (1)) * (WORLD_WIDTH)))\n    if <(item (index) of [world v]) > [0]> then\n        set [y v] to (collision)\n        set [y vel v] to [0]\n    end\nend\n\n@frame\n\nwhen I receive [init v]\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\n\n
Use the arrow keys to move and jump - that's it for now.