Graviton a Platformer Game

Instructions: Full Release: \n\nhttps://scratch.mit.edu/projects/564689790\n\n\n\nUse arrow keys to move left and right\nUse space to jump... or not?\n\nThis game is only a demo so there's only one level for now.\n\nedit: 1113 views and 100 loves!!!!!!!

@Stage\n\n@Tile\n\nwhen flag clicked\ndelete all of [world v]\nset [world height v] to [150]\nset [world width v] to [150]\nset [screen width v] to [17]\nset [screen height v] to [13]\nGen world\nSetup\nforever\n    broadcast (message1 v)\nend\n\ndefine Setup\nset [tile x v] to [0]\nrepeat (Screen width)\n    set [tile y v] to [0]\n    repeat (Screen height)\n        create clone of (_myself_ v)\n        change [tile y v] by (1)\n    end\n    change [tile x v] by (1)\nend\n\ndefine Replace\nswitch costume to (item (((tile x) * (World height)) + (tile y)) of [world v])\nset size to (1500) %\ngo to x: ((((tile x) * (32)) + ((Screen width) * (-16))) - (Cam x)) y: ((((tile y) * (32)) + ((Screen height) * (-16))) - (Cam y))\nif <([abs v] of ((((tile x) * (32)) + ((Screen width) * (-16))) - (Cam x)) ) > ((Screen width) * (16))> then\n    change [tile x v] by ((Screen width) * ((<((((tile x) * (32)) + ((Screen width) * (-16))) - (Cam x)) > [0]> * (-2)) + (1)))\nend\nif <([abs v] of ((((tile y) * (32)) + ((Screen height) * (-16))) - (Cam y)) ) > ((Screen height) * (16))> then\n    change [tile y v] by ((Screen height) * ((<((((tile y) * (32)) + ((Screen height) * (-16))) - (Cam y)) > [0]> * (-2)) + (1)))\nend\nset size to (200) %\n\nwhen I receive [message1 v]\nhide\nReplace\nshow\n\ndefine Gen world\nset [limit v] to [4]\nrepeat (8)\n    repeat ((round (limit)) - (1))\n        add [3] to [world v]\n    end\n    add [2] to [world v]\n    repeat ((World height) - (round (limit)))\n        add [1] to [world v]\n    end\nend\nrepeat ((World width) + (-8))\n    repeat (World height)\n        add [1] to [world v]\n    end\nend\n\nset size to (1500) %\ngo to x: ((((tile x) * (32)) + ((Screen width) * (-16))) - (Cam x)) y: ((((tile y) * (32)) + ((Screen height) * (-16))) - (Cam y))\nset size to (200) %\n\nset [cam y v] to [1300]\n\nchange [limit v] by (pick random (1.0) to (-0.5))\nadd (((pick random (0) to (1)) * (3)) + (1)) to [world v]\n\ndefine Refresh tiles\nset [index v] to [1]\nrepeat (World width)\n    repeat (World height)\n        if <(item (index) of [world v]) = [7]> then\n            replace item (index) of [world v] with [8]\n        else\n            if <(item (index) of [world v]) = [8]> then\n                replace item (index) of [world v] with [7]\n            end\n        end\n        change [index v] by (1)\n    end\nend\n\nwhen [s v] key pressed\n\nSave level\nstop [all v]\n\ndefine Save level\nset [level as var v] to []\nset [index v] to [1]\nrepeat ((World width) * (World height))\n    set [level as var v] to (join (level as var) (item (index) of [world v]))\n    change [index v] by (1)\nend\n\ndefine Read level (level)\nset [index v] to [0]\ndelete all of [world v]\nrepeat (length of (level))\n    change [index v] by (1)\n    add (letter (index) of (level)) to [world v]\nend\n\nwhen [r v] key pressed\n\nwhen flag clicked\nRead level (level as var)\n\nwait (3) seconds\n\n@Player\n\nset rotation style [left-right v]\n\ndefine Verr\nrepeat (6)\n    if <touching (tile v)?> then\n        change y by ((gravity) * (-1))\n    end\nend\nif <touching (tile v)?> then\n    change y by ((gravity) * (-1))\nend\n\ndefine X coll\nrepeat until <not <touching (tile v)?>>\n    change x by ((<[0] < (X vel)> * (-2)) + (1))\nend\nchange x by ((<[0] < (X vel)> * (-2)) + (1))\nset [x vel v] to [0]\n\ndefine Y coll\nrepeat until <not <touching (tile v)?>>\n    change y by ((<[0] < (Y vel)> * (-2)) + (1))\nend\n\nwhen flag clicked\ngo to x: (0) y: (50)\nset [gravity v] to [-1]\nreset player\nforever\n    Gameloop\nend\n\nGode mode loop\n\ndefine Gameloop\nchange [x vel v] by ((<key (right arrow v) pressed?> - <key (left arrow v) pressed?>) * (speed))\nif <([abs v] of (X vel) ) > [1]> then\n    switch costume to ((<(X vel) < [0]> + ((gravity) + (1))) + (1))\nend\nif <([abs v] of (X vel) ) > (speeed limit)> then\n    change [x vel v] by ((<key (left arrow v) pressed?> - <key (right arrow v) pressed?>) * (speed))\nend\nchange x by (X vel)\nset [x vel v] to ((X vel) * (0.775))\nif <touching (tile v)?> then\n    Verr\n    if <touching (tile v)?> then\n        change y by ((gravity) * (6))\n        X coll\n    end\nend\nchange [y vel v] by (gravity)\nchange y by (Y vel)\nif <touching (tile v)?> then\n    Y coll\n    set [y vel v] to [0]\n    if <key (space v) pressed?> then\n        set [gravity v] to ((gravity) * (-1))\n        change y by ((gravity) * (4))\n    end\n    switch costume to ((<(X vel) < [0]> + ((gravity) + (1))) + (1))\nend\nMove camera\nUpdate player\n\ndefine Move camera\nset [x v] to ((Cam x) + (x position))\nset [y v] to ((Cam y) + (y position))\nchange [cam x v] by (((X) - (Cam x)) / (5))\nchange [cam y v] by (((Y) - (Cam y)) / (8))\nif <(Cam x) < [0]> then\n    set [cam x v] to [0]\nend\nif <(Cam y) < [0]> then\n    set [cam y v] to [0]\nend\nif <(((World width) * (32)) - ((Screen width) * (32))) < (Cam x)> then\n    set [cam x v] to (((World width) * (32)) - ((Screen width) * (32)))\nend\nif <((World height) * (32)) < (Cam y)> then\n    set [cam y v] to (((World height) * (32)) - ((Screen height) * (32)))\nend\nset x to ((X) - (Cam x))\nset y to ((Y) - (Cam y))\n\ndefine reset player\nswitch costume to (costume1 v)\nset [gravity v] to [-1]\nset [width v] to (((15) / (2)) * (1.75))\nset [speed v] to [2]\nset [y vel v] to [0]\nset [speeed limit v] to [7]\nset [jump height v] to [13]\nset x to (-100)\nset [cam x v] to [-50]\nset y to (10)\nset [cam y v] to [0]\nMove camera\n\nreset player\n\ndefine Update player\nget tile x: (X) y: (Y)\nif <[deadly tiles v] contains (tile)?> then\n    reset player\nend\n\ndefine get tile x: (x) y: (y)\nset [tile v] to (item ((((round (((((3.125) * (((<(X vel) < [0]> * (-2)) - (-1)) * <([abs v] of (X vel) ) < [1.5]>)) + (x)) - ((Screen width) * (-16))) / (32))) + (0)) * (World height)) + ((round (((((13.125) * ((0) - (gravity))) + (y)) - ((Screen height) * (-16))) / (32))) + (gravity))) of [world v])\n\nchange [cam x v] by (1000)\n\npoint in direction (90)\n\nchange [x vel v] by (1)\n\ndefine Gode mode loop\nset [x vel v] to ((<key (right arrow v) pressed?> - <key (left arrow v) pressed?>) * (10))\nset [y vel v] to ((<key (up arrow v) pressed?> - <key (down arrow v) pressed?>) * (10))\nchange x by (X vel)\nchange y by (Y vel)\nMove camera\nif <mouse down?> then\n    replace item (((round ((((Cam x) + ((Screen width) * (16))) + (mouse x)) / (32))) * (World width)) + (round ((((Cam y) + ((Screen height) * (16))) + (mouse y)) / (32)))) of [world v] with (handling tile)\nend\n\nwhen flag clicked\n​​warn​​ [4848nbkj]\n\n@Main music\n\nwhen flag clicked\nset [music v] to [0]\nforever\n    play sound [Purple Planet Music - Sense Of Loss \(2 04\) 55bpm v] until done\nend\n\n@End screen\n\nwhen I receive [goal v]\nif <(screen displayed) = [0]> then\n    broadcast (transition v)\nend\n\nwhen flag clicked\nset [screen displayed v] to [0]\nhide\ngo to [back v] layer\n\n\n\nwhen I receive [transition v]\nset [screen displayed v] to [1]\ngo to [front v] layer\nshow\nset [ghost v] effect to (100)\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\n\n@Flag\n\nwhen I receive [message1 v]\nset size to (1000) %\ngo to x: ((3300) - (Cam x)) y: ((647) - (Cam y))\nset size to (200) %\nif <touching (player v)?> then\n    broadcast (Goal v)\nend\n\n@Thumbnail\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (100)\n\n