List Platformer Engine

Instructions: Use the arrow keys to move the character and jump on platforms.\nAvoid spikes.\nThis isn't a whole game, just a test.\nRemix it with new levels!\nLove and favorite if you enjoy it!

@Stage\n\nwhen flag clicked\nforever\n    play sound [bensound-summer v] until done\nend\n\n@main\n\ndefine draw character\nreplace item (round (playerY)) of [level 1 v] with (join (leftSpace) (join [😎] (rightSpace)))\n\nwhen flag clicked\nset [y velocity v] to [0]\nset [playerx v] to [1]\nset [playery v] to [11]\nhide list [level 1 v]\ninit\nfindLineSpace x: (round (playerX)) y: (round (playerY))\nforever\n    fillLine\n    if <(letter (round (playerX)) of (item ((round (playerY)) - (1)) of [level 1 v])) = [~]> then\n        set [y velocity v] to [0]\n        change [playery v] by (1)\n    else\n        change [y velocity v] by (0.1)\n        change [playery v] by (y velocity)\n    end\n    change [in air v] by (1)\n    if <(blockOnTopOf) = [∆]> then\n        set [playerx v] to [1]\n        set [playery v] to [11]\n    end\n    handle ground\n    if <<key (up arrow v) pressed?> and <(in air) < [2]>> then\n        set [y velocity v] to [-0.9]\n    end\n    findLineSpace x: (round (playerX)) y: (round (playerY))\n    draw character\n    wait (0) seconds\nend\n\ndefine fillLine\nreplace item (round (playerY)) of [level 1 v] with (join (leftSpace) (join (blockOnTopOf) (rightSpace)))\n\nwhen flag clicked\nforever\n    if <key (left arrow v) pressed?> then\n        if <(playerX) > [1]> then\n            if <not <(letter ((round (playerX)) - (1)) of (item (round (playerY)) of [level 1 v])) = [~]>> then\n                change [playerx v] by (-0.7)\n            end\n        end\n    end\n    if <key (right arrow v) pressed?> then\n        if <(playerX) < [58]> then\n            if <not <(letter ((round (playerX)) + (2)) of (item (round (playerY)) of [level 1 v])) = [~]>> then\n                change [playerx v] by (0.7)\n            end\n        end\n    end\nend\n\ndefine findLineSpace x: (x) y: (y)\nset [blockontopof v] to (letter (x) of (item (y) of [level 1 v]))\nset [leftspace v] to []\nset [characternum v] to [1]\nrepeat ((x) - (1))\n    set [character v] to (letter (characterNum) of (item (y) of [level 1 v]))\n    set [leftspace v] to (join (leftSpace) (character))\n    change [characternum v] by (1)\nend\nset [rightspace v] to []\nset [characternum v] to ((x) + (1))\nrepeat ((length of (item (y) of [level 1 v])) - (x))\n    set [character v] to (letter (characterNum) of (item (y) of [level 1 v]))\n    set [rightspace v] to (join (rightSpace) (character))\n    change [characternum v] by (1)\nend\n\ndefine check if touching ground\nif <<(letter (round (playerX)) of (item (round (playerY)) of [level 1 v])) = [~]> or <(letter ((round (playerX)) + (1)) of (item (round (playerY)) of [level 1 v])) = [~]>> then\n    set [touchingground v] to [True]\nelse\n    set [touchingground v] to [False]\nend\n\ndefine handle ground\ncheck if touching ground\nrepeat until <(touchingGround) = [False]>\n    change [playery v] by (-0.1)\n    set [y velocity v] to [0]\n    set [in air v] to [0]\n    check if touching ground\nend\n\nwhen [r v] key pressed\nfillLine\n\ndefine init\ndelete all of [level 1 v]\nset [i v] to [1]\nrepeat (length of [template v])\n    add (item (i) of [template v]) to [level 1 v]\n    change [i v] by (1)\nend\n\n@thumb\n\nwhen flag clicked\nhide\nhide list [level 1 v]\n\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\n