Platformer | #games
@Stage\n\nwhen flag clicked\nforever\n    play sound [ye v] until done\nend\n\n@thumbnail\n\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\n\nwhen flag clicked\nhide\n\n@Player\n\nwhen flag clicked\npoint in direction (90)\nset [gravity v] to [-1.5]\nset [jump force v] to [13.5]\nset [acceleration v] to [1.5]\nset [resistance v] to [0.8]\nReset and Begin Level\nif <touching (danger v)?> then\n    Reset and Begin Level\nend\n\ndefine Move - In steps (steps)\nchange [falling v] by (1)\nrepeat (steps)\n    set [last value v] to (x position)\n    change x by ((speed x) / (steps))\n    Check Touching solid\n    if <(touching) > [0]> then\n        set x to (last value)\n        set [speed x v] to [0]\n    end\n    set [last value v] to (y position)\n    change y by ((speed y) / (steps))\n    Check Touching solid\n    if <(touching) > [0]> then\n        set y to (last value)\n        if <(speed y) < [0]> then\n            set [falling v] to [0]\n        end\n        set [speed y v] to [0]\n    end\nend\n\ndefine Check Touching solid\nif <touching (level v)?> then\n    set [touching v] to [1]\nelse\n    set [touching v] to [0]\nend\n\nwhen I receive [tick - player v]\nControls - Up and Down\nControls - Left and Right\nMove - In steps (([abs v] of (speed x) ) + ([abs v] of (speed y) ))\n\ndefine Controls - Up and Down\nif <key (up arrow v) pressed?> then\n    if <(falling) < [3]> then\n        set [speed y v] to (JUMP FORCE)\n    end\nend\nchange [speed y v] by (GRAVITY)\n\ndefine Controls - Left and Right\nif <key (left arrow v) pressed?> then\n    change [speed x v] by ((0) - (ACCELERATION))\nend\nif <key (right arrow v) pressed?> then\n    change [speed x v] by (ACCELERATION)\nend\nset [speed x v] to ((speed x) * (RESISTANCE))\n\ndefine Reset and Begin Level\nset [scene # v] to [1]\nset [speed x v] to [0]\nset [speed y v] to [0]\nset [falling v] to [99]\npoint in direction (90)\ngo to x: (-150) y: (55)\nbroadcast (Change Scene v)\nbroadcast (Game Loop v)\nbroadcast (Scene Reset v)\n\nwhen I receive [game loop v]\nset [ghost v] effect to (0)\nforever\n    broadcast (Tick - Player v)\n    broadcast (Tick - Last v)\nend\n\nwhen I receive [tick - last v]\nif <(x position) > [235]> then\n    Begin Scene # ((SCENE #) + (1)) go to x, y: [-235] []\nend\nif <touching (danger v)?> then\n    broadcast (Lose Life v)\nend\n\ndefine Begin Scene # (scene #) go to x, y: (x) (y)\nset [scene # v] to (scene #)\nif <(x) > []> then\n    set x to (x)\nend\nif <(y) > []> then\n    set y to (y)\nend\nbroadcast (Change Scene v)\nstop [other scripts in sprite v]\nwait (0) seconds\nif <(x) > []> then\n    Fix Collision in Direction [0]\nelse\n    Fix Collision in Direction [90]\nend\nbroadcast (Game Loop v)\n\ndefine Fix Collision in Direction (dir)\nset [temp v] to (direction)\nset [distance v] to [1]\npoint in direction (dir)\nrepeat (128)\n    Check Touching solid\n    if <(touching) < [1]> then\n        point in direction (temp)\n        stop [this script v]\n    end\n    move (distance) steps\n    turn right (180) degrees\n    change [distance v] by (1)\nend\n\nwhen I receive [lose life v]\nbroadcast (Scene Reset v)\nstop [other scripts in sprite v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nwait (0.5) seconds\nReset and Begin Level\n\nwhen flag clicked\nsay (join [Hello, ] (username)) for (3) seconds\n\n@Level\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\nif <touching (danger v)?> then\n    broadcast (Scene Reset v)\nend\n\nwhen I receive [change scene v]\nswitch costume to (join [Scene] (SCENE #))\n\nwhen I receive [scene reset v]\nshow\nswitch costume to (scene1  v)\ngo to x: (0) y: (0)\n\nif <touching (danger v)?> then\n    broadcast (Scene Reset v)\nend\n\n@Danger\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen I receive [change scene v]\nswitch costume to (blank v)\nswitch costume to (join [Scene] (SCENE #))\n\nif <(SCENE #) = [3]> then\n    forever\n        set y to ((3) * ([sin v] of ((timer) * (180)) ))\n    end\nend\nif <(SCENE #) = [4]> then\n    forever\n        set y to ((3) * ([sin v] of ((timer) * (180)) ))\n    end\nend\n\nwhen I receive [scene reset v]\nshow\nswitch costume to (scene1  v)\n\n
(controls do not work for mobile players)\nTry to make it through the obstacles\n\n★ CONTROLS ★\nLeft and right  arrow keys = Move\nup Arrow key = Jump