Text Based Platformer Demo

Instructions: Arrow keys to move and jump. \n\nIf nothing moves, click OUTSIDE the game. For some reason, if you have clicked on the list, scratch thinks you are trying to copy from it and won't modify it.\n\n2021/4/16 9:36 AM - I've got an unshared project that is a copy of this with more features. A full game based on this is in the works, 

@Stage\n\ndefine renderCharacters (line)\nset [counter1 v] to [1]\nrepeat (49)\n    if <not <<([abs v] of ((line) - (playerYPos)) ) < [0.75]> and <([abs v] of ((counter1) - (playerXPos)) ) < [0.75]>>> then\n        if <(letter (counter1) of (item (line) of [currentlevel v])) = [s]> then\n            replace item (line) of [gamewindow v] with (join (item (line) of [gamewindow v]) [   ])\n        else\n            replace item (line) of [gamewindow v] with (join (item (line) of [gamewindow v]) (letter (counter1) of (item (line) of [currentlevel v])))\n        end\n        change [counter1 v] by (1)\n    else\n        if <([abs v] of ((playerYPos) - (round (playerYPos))) ) < [0.25]> then\n            if <(round (playerYPos)) = (line)> then\n                replace item (line) of [gamewindow v] with (join (item (line) of [gamewindow v]) [█])\n            end\n        else\n            if <(playerYPos) > (line)> then\n                replace item (line) of [gamewindow v] with (join (item (line) of [gamewindow v]) [▄])\n            else\n                replace item (line) of [gamewindow v] with (join (item (line) of [gamewindow v]) [▀])\n            end\n        end\n        change [counter1 v] by (1)\n    end\nend\n\ndefine clearGameWindow\nset [counter2 v] to [1]\nrepeat (9)\n    if <[rowschanged v] contains (counter2)?> then\n        replace item (counter2) of [gamewindow v] with []\n    end\n    change [counter2 v] by (1)\nend\n\ndefine render\nclearGameWindow\nset [counter2 v] to [1]\nrepeat (9)\n    if <[rowschanged v] contains (counter2)?> then\n        renderCharacters (counter2)\n    end\n    change [counter2 v] by (1)\nend\ndelete all of [rowschanged v]\n\nwhen flag clicked\nset [playeryvel v] to [0]\nset [playerxpos v] to [25]\nset [playerypos v] to [3]\nset [lastcontroltime v] to [0]\nforever\n    controls\n    render\nend\n\ndefine controls\nif <<<<key (up arrow v) pressed?> and <not <(letter (playerXPos) of (item (round ((playerYPos) + (1))) of [currentlevel v])) = [s]>>> and <(playerYVel) > [-0.1]>> and <(letter (playerXPos) of (item (round ((playerYPos) + (-1))) of [currentlevel v])) = [s]>> then\n    set [playeryvel v] to [-1]\nend\nif <((lastControlTime) + (0.035)) < (timer)> then\n    set [lastcontroltime v] to (timer)\n    if <key (left arrow v) pressed?> then\n        if <(playerXPos) > [1]> then\n            if <<(letter ((playerXPos) + (-1)) of (item (round ((playerYPos) + (playerYVel))) of [currentlevel v])) = [s]> and <(letter ((playerXPos) + (-1)) of (item (round (playerYPos)) of [currentlevel v])) = [s]>> then\n                change [playerxpos v] by (-1)\n            end\n        end\n    end\n    if <key (right arrow v) pressed?> then\n        if <(playerXPos) < [49]> then\n            if <<(letter ((playerXPos) + (1)) of (item (round ((playerYPos) + (playerYVel))) of [currentlevel v])) = [s]> and <(letter ((playerXPos) + (1)) of (item (round (playerYPos)) of [currentlevel v])) = [s]>> then\n                change [playerxpos v] by (1)\n            end\n        end\n    end\n    if <(letter (playerXPos) of (item (round ((playerYPos) + (1))) of [currentlevel v])) = [s]> then\n        if <(letter (playerXPos) of (item (round ((playerYPos) + (-1))) of [currentlevel v])) = [s]> then\n            if <(playerYVel) < [0.8]> then\n                change [playeryvel v] by (gravity)\n            end\n        else\n            set [playerypos v] to (round (playerYPos))\n            change [playeryvel v] by (gravity)\n            if <[0] > (playerYVel)> then\n                set [playeryvel v] to [0]\n            end\n        end\n    else\n        set [playerypos v] to (round (playerYPos))\n        if <(playerYVel) > [0]> then\n            set [playeryvel v] to [0]\n        else\n            change [playeryvel v] by (gravity)\n        end\n    end\n    change [playerypos v] by (playerYVel)\nend\nrowChange (([ceiling v] of (playerYPos) ) + (1))\nrowChange (([floor v] of (playerYPos) ) + (-1))\nrowChange ([ceiling v] of (playerYPos) )\nrowChange ([floor v] of (playerYPos) )\n\ndefine rowChange (row)\nif <not <[rowschanged v] contains (row)?>> then\n    add (row) to [rowschanged v]\nend\n\nrowChange (([ceiling v] of (playerYPos) ) + (1))\nrowChange (([floor v] of (playerYPos) ) + (-1))\nrowChange ([ceiling v] of (playerYPos) )\nrowChange ([floor v] of (playerYPos) )\n\n@tbp\n\nwhen [1 v] key pressed\nshow\nshow list [currentlevel v]\nshow list [gui v]\nshow list [gamewindow v]\n\nwhen flag clicked\nhide\nhide list [gamewindow v]\nhide list [gui v]\n\n