Toy Story: the Platformer
@Stage\n\n@intro\n\ndefine Smooth Glide x: (x) y: (y) speed: (speed)\nrepeat until <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>>\n    change x by (((round (x)) - (round (x position))) / (speed))\n    change y by (((round (y)) - (round (y position))) / (speed))\nend\ngo to x: (x) y: (y)\n\nwhen flag clicked\nset volume to (100) %\nforever\n    play sound [Toy Story - You've got a friend in me - Randy Newman v] until done\nend\n\nstop all sounds\n\nstop [other scripts in sprite v]\n\nwhen flag clicked\ngo to x: (0) y: (270)\nswitch costume to (toy_story v)\nset size to (85) %\ncreate clone of (_myself_ v)\nhide\nwait (0.6) seconds\nshow\nSmooth Glide x: (0) y: (75) speed: (8)\n\nwhen I start as a clone\ngo to x: (0) y: (-180)\nswitch costume to (play v)\nset size to (100) %\nhide\nwait (1.1) seconds\nshow\nSmooth Glide x: (0) y: (-90) speed: (8)\nwait until <<mouse down?> and <touching (mouse-pointer v)?>>\nSmooth Glide x: (0) y: (-200) speed: (4)\nbroadcast (start v)\ndelete this clone\n\nwhen I receive [start v]\nwait (0.1) seconds\nSmooth Glide x: (0) y: (275) speed: (2.5)\nhide\nrepeat (25)\n    change volume by (-4)\nend\nstop [other scripts in sprite v]\nstop [this script v]\n\nset size to (100) %\n\n@platform\n\ndefine set size to (dimensions)\nswitch costume to (0 v)\nset size to (dimensions) %\nnext costume\n\nwhen flag clicked\nset [xpos v] to [275]\nset [debug y? v] to [false]\nset [platform ypos v] to [-100]\ngo to x: (xpos) y: ((platform ypos) - (3))\nset size to [600]\nhide\nforever\n    if <(y position) > [200]> then\n        go to x: (xpos) y: ((platform ypos) - (-50))\n    end\nend\n\nwhen I receive [start v]\nshow\nset [speed v] to [1.8]\nforever\n    if <key (left arrow v) pressed?> then\n        change [velocityx v] by (Speed)\n    end\n    if <key (right arrow v) pressed?> then\n        change [velocityx v] by (() - (Speed))\n    end\n    change x by (VelocityX)\n    set [velocityx v] to ((VelocityX) * (0.8))\nend\n\ndefine debug ypos\nrepeat until <not <touching (toy v)?>>\n    change y by (-1)\nend\n\ndefine jump\nif <key (up arrow v) pressed?> then\n    repeat until <not <touching (toy v)?>>\n        change y by (-2)\n    end\n    set [jumping? v] to [true]\n    set [jump v] to (() - (jump power))\n    repeat (jump power)\n        change [jump v] by (jump speed)\n        change y by (jump)\n    end\n    set [jumping? v] to [false]\n    if <key (up arrow v) pressed?> then\n        fall\n    end\nend\n\nwhen I receive [start v]\nset [jump v] to [0]\nset [jump speed v] to [1]\nset [jump power v] to [12]\nshow\n\nwhen flag clicked\nset [jumping? v] to [false]\n\nwhen I receive [start v]\nforever\n    if <<key (up arrow v) pressed?> and <(falling?) = <[0] = [1]>>> then\n        debug ypos\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <key (up arrow v) pressed?> then\n        if <(falling?) = <[0] = [1]>> then\n            jump\n        end\n    end\nend\n\ndefine debug ypos 3\nrepeat until <not <touching (toy v)?>>\n    change y by (1)\nend\n\nwhen I receive [start v]\nforever\n    if <<(jumping?) = <[0] = [1]>> and <not <key (up arrow v) pressed?>>> then\n        set [jump v] to [0]\n        fall\n    end\nend\n\ndefine fall\nset [falling? v] to [true]\nrepeat until <touching (toy v)?>\n    change [jump v] by (() - (jump speed))\n    change y by (() - (jump))\nend\nset [falling? v] to [false]\ndebug ypos\n\nset [color v] effect to (0)\n\nwhen I receive [start v]\nwait (1) seconds\nset volume to (100) %\nforever\n    play sound [Go See Lotso v] until done\nend\n\ndebug ypos\n\ndebug ypos 3\n\ndefine debug ypos 2\n\nif <touching (toy v)?> then\n    repeat until <not <touching (toy v)?>>\n        change y by (1)\n    end\nend\n\nchange y by (-1)\n\n@toy\n\nwhen flag clicked\npoint in direction (90)\nhide\n\nwhen I receive [start v]\ngo to x: (0) y: ((platform ypos) + (40))\nset rotation style [left-right v]\nset [brightness v] effect to (10)\ngo to [front v] layer\nset size to (85) %\nshow\nforever\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n        next costume\n    end\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n        next costume\n    end\n    if <not <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>>> then\n        switch costume to (costume3 v)\n    end\nend\n\ndefine next costume\nif <key (up arrow v) pressed?> then\n    next costume\n    wait (0.15) seconds\nelse\n    next costume\n    wait (0.02) seconds\nend\n\nnext costume\n\nif <(costume [number v]) = [1]> then\n    next costume\nend\n\n\n\nset size to (100) %\npoint in direction (90)\nset rotation style [all around v]\nrepeat (10)\n    turn right (1) degrees\n    change size by (-1)\n    move (-0.5) steps\nend\n\nforever\nend\n\nwhen flag clicked\nwait until <touching color (#9966ff)?>\nbroadcast (end v)\n\n@room\n\nwhen I start as a clone\n\ncreate clone of (_myself_ v)\n\nrepeat (10)\n\nwhen flag clicked\nhide\ngo to [back v] layer\nset [sensitivity v] to [7]\nset size to [400]\n\nwhen I receive [start v]\nset [brightness v] effect to (-10)\nshow\nforever\n    glide (0.1) secs to x: (round (([x position v] of [platform v]) / (sensitivity))) y: (round (([y position v] of [platform v]) / (sensitivity)))\nend\n\ndefine set size to (dimensions)\nswitch costume to (0 v)\nset size to (dimensions) %\nnext costume\n\n@Sprite1\n\nwhen I receive [end v]\nshow\ngo to [front v] layer\n\nwhen flag clicked\nhide\n\n
1. Arrow keys to move.\n\n2. Find the purple exit.\n\n3. Enjoy!