jelly platformer

Instructions: Controls PC\nWSAD and arrow keys\nspace: jump\nControls: touch screen\ndrag left: Left\ndrag right: right\ndrag up: jump

@Stage\n\n@p1\n\nwhen flag clicked\nhide\ndelete all of [x v]\ndelete all of [y v]\nrepeat (4)\n    add [0] to [x v]\n    add [0] to [y v]\nend\nset [ids v] to [1]\npoint in direction (90)\nset [xf v] to [-16]\nset [yf v] to [16]\ncreate clone of (_myself_ v)\nchange [ids v] by (1)\nset [xf v] to [16]\nset [yf v] to [16]\nturn right (90) degrees\ncreate clone of (_myself_ v)\nchange [ids v] by (1)\nset [xf v] to [16]\nset [yf v] to [-16]\nturn right (90) degrees\ncreate clone of (_myself_ v)\nchange [ids v] by (1)\nset [xf v] to [-16]\nset [yf v] to [-16]\nturn right (90) degrees\ncreate clone of (_myself_ v)\n\ndefine physics\nif <key (space v) pressed?> then\n    set [j v] to [1.5]\nelse\n    set [j v] to [1]\nend\nif <(on) = [1]> then\n    set [sx v] to (((((([x position v] of [player v]) + (((xf) * (2)) + (((xf) * (j)) * (-1)))) - (x position)) * (.4)) + (sx)) * (.7))\n    set [sy v] to (((((([y position v] of [player v]) + ((yf) * (j))) - (y position)) * (.4)) + (sy)) * (.7))\nelse\n    set [sx v] to (((((pick random (-240) to (240)) - (x position)) * (.4)) + (sx)) * (.7))\n    set [sy v] to (((((pick random (180) to (-180)) - (y position)) * (.4)) + (sy)) * (.7))\nend\nchange x by (sx)\nif <touching (solid v)?> then\n    repeat until <not <touching (solid v)?>>\n        change x by (((sx) / ([abs v] of (sx) )) * (-1))\n    end\n    set [sx v] to [0]\n    set [sy v] to ((sy) * (.5))\nend\nchange y by (sy)\nif <touching (solid v)?> then\n    repeat until <not <touching (solid v)?>>\n        change y by (((sy) / ([abs v] of (sy) )) * (-1))\n    end\n    set [sy v] to [0]\n    set [sx v] to ((sx) * (.5))\nend\nreplace item (IDs) of [x v] with (round (x position))\nreplace item (IDs) of [y v] with (round (y position))\n\nwhen I start as a clone\nshow\nset [sx v] to [0]\nset [sy v] to [0]\ngo to x: (0) y: (0)\ngo to [front v] layer\nforever\n    physics\nend\n\nwhen flag clicked\nforever\n    set [c v] to (pick random (1) to (4))\n    if <[100] < ((([abs v] of ((item (((c) mod (4)) + (1)) of [x v]) - (item ((((c) - (1)) mod (4)) + (1)) of [x v])) ) * (1)) + (([abs v] of ((item ((((c) - (1)) mod (4)) + (1)) of [y v]) - (item (((c) mod (4)) + (1)) of [y v])) ) * (1)))> then\n        set [on v] to [0]\n        start sound [Rip v]\n        wait (.1) seconds\n        broadcast (reset v)\n        set [on v] to [1]\n    end\nend\n\nwhen I receive [reset v]\nset [sx v] to [0]\nset [sy v] to [0]\nreplace item (1) of [x v] with [0]\nreplace item (1) of [x v] with [0]\nreplace item (2) of [x v] with [0]\nreplace item (2) of [x v] with [0]\nreplace item (3) of [x v] with [0]\nreplace item (3) of [x v] with [0]\nreplace item (4) of [x v] with [0]\nreplace item (4) of [x v] with [0]\ngo to x: (-200) y: (0)\n\n@solid\n\nwhen flag clicked\nset [lvl v] to [1]\n\nwhen I receive [reset v]\ngo to x: (0) y: (0)\nswitch costume to (LvL)\n\n@player\n\nwhen flag clicked\nbroadcast (reset v)\nforever\n    show\n    p6\n    hide\nend\n\ndefine p6\nchange y by (Yv)\nset [xv v] to ((Xv) * (.8))\nif <touching (solid v)?> then\n    repeat until <not <touching (solid v)?>>\n        change y by (((Yv) / ([abs v] of (Yv) )) * (-1))\n    end\n    set [yv v] to [0]\n    if <<(mouse y) > ((My) + (20))> or <<key (up arrow v) pressed?> or <key (space v) pressed?>>> then\n        set [yv v] to [10]\n    end\nelse\n    change [yv v] by (-1)\nend\nchange x by (Xv)\nif <touching (solid v)?> then\n    repeat until <not <touching (solid v)?>>\n        change x by (((Xv) / ([abs v] of (Xv) )) * (-1))\n    end\n    set [xv v] to [0]\nend\nif <<(mouse x) < ((Mx) + (-20))> or <<key (a v) pressed?> or <key (left arrow v) pressed?>>> then\n    change [xv v] by (-2)\nend\nif <<((Mx) + (20)) < (mouse x)> or <<key (d v) pressed?> or <key (right arrow v) pressed?>>> then\n    change [xv v] by (2)\nend\nif <touching (win v)?> then\n    change [lvl v] by (1)\n    broadcast (reset v)\nend\nif <(y position) = [-180]> then\n    broadcast (reset v)\nend\n\nwhen I receive [reset v]\nset [xv v] to [0]\nset [yv v] to [0]\ngo to x: (-200) y: (0)\nstart sound [pop v]\n\n@pen\n\nwhen flag clicked\nset pen color to (#ffffff)\nforever\n    broadcast (message1 v)\nend\n\ndefine shape\nset pen size to (2)\nerase all\ngo to x: (item (4) of [x v]) y: (item (4) of [y v])\npen down\nset [c v] to [1]\nrepeat (4)\n    go to x: (item (c) of [x v]) y: (item (c) of [y v])\n    change [c v] by (1)\nend\npen up\n\nwhen I receive [message1 v]\nshape\n\n@win\n\nwhen I receive [reset v]\ngo to x: (200) y: (-100)\nforever\n    turn right (15) degrees\nend\n\n@title\n\nwhen flag clicked\nhide\n\n@joystick\n\nwhen flag clicked\nforever\n    if <mouse down?> then\n        set [mx v] to (mouse x)\n        set [my v] to (mouse y)\n        repeat until <not <mouse down?>>\n        end\n    else\n        set [mx v] to (mouse x)\n        set [my v] to (mouse y)\n    end\nend\n\n