advanced platformer engine
@Stage\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    broadcast (tick v)\nend\n\ndefine engine; speed: (speed) friction: (friction) jump height: (jump) gravity: (gravity) jumps: (jumps)\nset rotation style [left-right v]\npoint in direction (<key (left arrow v) pressed?> - <key (right arrow v) pressed?>)\nif <key (left arrow v) pressed?> then\n    change [xv v] by ((speed) * (-1))\nend\nif <key (right arrow v) pressed?> then\n    change [xv v] by (speed)\nend\nset [xv v] to ((xv) * (friction))\nchange x by (xv)\nif <touching (sprite2 v)?> then\n    repeat until <not <touching (sprite2 v)?>>\n        change x by (((xv) / ([abs v] of (xv) )) * (-1))\n    end\n    set [xv v] to [0]\nend\nchange y by (-1)\nif <<key (up arrow v) pressed?> and <(jumps) > [0]>> then\n    if <not <(up_pressed?) = [true]>> then\n        set [up_pressed? v] to [true]\n        set [yv v] to (jump)\n        change [jumps v] by (-1)\n    end\nelse\n    set [up_pressed? v] to [false]\nend\nif <touching (sprite2 v)?> then\n    set [jumps v] to ((jumps) - (1))\n    if <key (up arrow v) pressed?> then\n        if <not <(up_pressed?) = [true]>> then\n            set [up_pressed? v] to [true]\n            set [yv v] to (jump)\n            change [jumps v] by (-1)\n        end\n    end\nelse\n    change x by ((direction) * (-1))\n    if <touching (sprite2 v)?> then\n        if <key (up arrow v) pressed?> then\n            set [yv v] to ((jump) / (1.5))\n            set [xv v] to ((9) * (direction))\n        end\n    end\n    change x by (direction)\nend\nchange y by (yv)\nchange [yv v] by ((gravity) * (-1))\nif <touching (sprite2 v)?> then\n    repeat until <not <touching (sprite2 v)?>>\n        change y by (((yv) / ([abs v] of (yv) )) * (-1))\n    end\n    set [yv v] to [0]\nend\n\nwhen I receive [tick v]\nengine; speed: [1.5] friction: [0.84] jump height: [12] gravity: [1] jumps: [3]\n\n@Sprite2\n\n
you can adjust speed, friction, gravity, jump height and also how many jumps you can do when you are in the air\n\nFeel free to use this engine for your games just give credit to me 