Bob the Platformer
@Stage\n\n@Level\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 (join [Scene] (SCENE #))\n\n@Bob\n\nwhen flag clicked\nset [gravity v] to [-1.28]\nset [jump force v] to [15]\nset [acceleration v] to [1.5]\nset [resistance v] to [0.8]\nReset and Begin Level\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\nwhen flag clicked\nforever\n    play sound [recording3 v] until done\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]\ngo to x: (-150) y: (50)\nbroadcast (Change Scene v)\nbroadcast (Game Loop v)\n\nwhen I receive [game loop v]\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    change [scene # v] by (1)\n    broadcast (Change Scene v)\n    set x to (-235)\nend\n\nif <(x position) < [235]> then\n    change [scene # v] by (-1)\n    broadcast (Change Scene v)\n    set x to (-235)\nend\n\nwhen flag clicked\nset [time v] to [0]\nforever\n    wait (0.1) seconds\n    change [time v] by (0.1)\n    if <(Time) < [0.1]> then\n        if <touching color (#a07171)?> then\n            set [time v] to (Time)\n        end\n        stop [all v]\n    end\nend\n\n@Spawn\n\nwhen flag clicked\ngo to x: (-200) y: (0)\nhide\n\n
use the arrows keys to move Bob around\nand don't fall off the platforms :)\nunless you want to see what happens\n