scrolling platformer engine
@Stage\n\n@Player\n\nwhen flag clicked\nset rotation style [left-right v]\nforever\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n    end\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n    end\nend\n\ndefine go\nswitch costume to (hitbox v)\nchange [yv v] by (-1)\nchange y by (YV)\nif <touching (level v)?> then\n    repeat until <not <touching (level v)?>>\n        change y by ((([abs v] of (YV) ) / (YV)) * (-1))\n    end\n    set [yv v] to (<<key (up arrow v) pressed?> and <(([abs v] of (YV) ) / (YV)) = [-1]>> * (12))\nend\nchange x by ((<key (right arrow v) pressed?> * (6)) + (<key (left arrow v) pressed?> * (-6)))\nset [slope v] to [0]\nrepeat until <<(slope) = [-8]> or <not <touching (level v)?>>>\n    change y by (1)\n    change [slope v] by (-1)\nend\nif <touching (level v)?> then\n    change y by (slope)\n    repeat until <not <touching (level v)?>>\n        change x by ((<key (right arrow v) pressed?> * (-6)) + (<key (left arrow v) pressed?> * (6)))\n    end\nend\nchange [sx v] by (x position)\nchange [sy v] by (y position)\ngo to x: (0) y: (0)\nif <(sy) < [-500]> then\n    set [yv v] to [0]\n    set [sx v] to [0]\n    set [sy v] to [0]\nend\nswitch costume to (state)\n\nwhen flag clicked\nset [sx v] to [0]\nset [sy v] to [0]\nset [yv v] to [0]\ngo to x: (0) y: (100)\nforever\n    go\nend\n\nwhen flag clicked\nset [state v] to [3]\nforever\n    if <not <(YV) = [0]>> then\n        if <(YV) > [0]> then\n            set [state v] to [11]\n        else\n            set [state v] to [12]\n        end\n    else\n        if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n            change [state v] by (1)\n            if <(state) > [10]> then\n                set [state v] to [3]\n            end\n            wait (.05) seconds\n        else\n            set [state v] to [2]\n        end\n    end\nend\n\n@level\n\nwhen flag clicked\nswitch costume to (1 v)\nhide\nset [level x v] to [0]\nrepeat (3)\n    create clone of (_myself_ v)\n    change [level x v] by (470)\n    next costume\nend\n\nwhen I start as a clone\nshow\nforever\n    go to x: (((sx) * (-1)) + (level X)) y: ((sy) * (-1))\nend\n\n@frame\n\nwhen flag clicked\nswitch costume to (frame v)\nforever\n    if <key (space v) pressed?> then\n        next costume\n        wait until <not <key (space v) pressed?>>\n    end\nend\n\n@thumbnail\n\nwhen flag clicked\nhide\n\nwhen [8 v] key pressed\ngo to [front v] layer\nshow\n\n
arrow keys