Savage||A mobile friendly platformer

Instructions: WASD to move\n\nFor more fun do this:\nhttps://scratch.mit.edu/projects/359946552/\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nComment: >:(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nComment COOL\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nComment Scream!\n\n\n\n\n\n\n\n

@Stage\n\n@Everything\n\nwhen flag clicked\nReset Objects\nset [rot-x v] to [0]\nset [rot-y v] to [0]\nset [x-rot plus v] to [0]\nset [y-rot plus v] to [0]\nset [x-pos v] to [0]\nset [y-pos v] to [0]\nset [z-pos v] to [0]\nset [left/right velocity v] to [0]\nset [forward/back velocity v] to [0]\nset [y-vel v] to [0]\nforever\n    refresh\n    change [rot-x v] by (1)\n    if <mouse down?> then\n        change [mouse down for v] by (0.01)\n    else\n        set [mouse down for v] to [0]\n    end\n    change [x-rot plus v] by ((([sqrt v] of (mouse down for) ) / (0.2)) * ((mouse x) / ([abs v] of (mouse x) )))\n    set [rot-x v] to (((mouse x) * (1)) + (x-rot plus))\n    set [rot-y v] to ((mouse y) * (1))\n    if <([abs v] of (rot-Y) ) > [45]> then\n        set [rot-y v] to ((([abs v] of (rot-Y) ) / (rot-Y)) * (45))\n    end\n    change [y-pos v] by (Y-vel)\n    if <[0] < (y-pos)> then\n        change [y-vel v] by (-1)\n    else\n        set [y-vel v] to [0]\n        set [y-pos v] to [0]\n        if <<(y-pos) < [1]> and <key (space v) pressed?>> then\n            set [y-vel v] to [8]\n        end\n    end\n    set [forward/back velocity v] to ((((Forward/back velocity) * (1)) + ((<key (w v) pressed?> - <key (s v) pressed?>) * (1))) / (2))\n    set [left/right velocity v] to ((((Left/right velocity) * (1)) + ((<key (d v) pressed?> - <key (a v) pressed?>) * (1))) / (2))\n    change [x-pos v] by (((Left/right velocity) * (([cos v] of (rot-X) ) * (5))) + ((Forward/back velocity) * (([sin v] of (() - (rot-X)) ) * (-5))))\n    change [z-pos v] by (((Left/right velocity) * (([sin v] of (rot-X) ) * (5))) + ((Forward/back velocity) * (([cos v] of (() - (rot-X)) ) * (-5))))\n    if <([abs v] of (rot-Y) ) > [90]> then\n        set [rot-y v] to ((([abs v] of (rot-Y) ) / (rot-Y)) * (90))\n    end\nend\n\ndefine refresh\nset pen color to (#000000)\nset pen size to (4)\npen up\nerase all\nswitch costume to (costume1 v)\nset size to (800) %\nswitch costume to (costume2 v)\nshow\nSort distance and calculate order\nDraw backdrop\nrepeat until <(length of [object number v]) = [0]>\n    Draw Object no. (item (length of [object number v]) of [object number v])\n    delete (length of [object number v]) of [object number v]\nend\nhide\nSort distance and calculate order\n\ndefine Draw Object at X: (xp) Y: (yp) Z: (zp) Costume: (costume) Size: (size)\nset [t-x v] to ((xp) - (x-pos))\nset [t-y v] to ((yp) - (y-pos))\nset [t-z v] to ((zp) - (z-pos))\nset [abs distance v] to ((((((t-X) * ([sin v] of ((rot-X) / (-1)) )) + ((t-Z) * ([cos v] of ((rot-X) / (1)) ))) * ([cos v] of (rot-Y) )) + ((t-Y) * ([sin v] of ((rot-Y) / (-1)) ))) / (200))\nset [distance 2 v] to ([sqrt v] of (((t-X) * (t-X)) + (((t-Y) * (t-Y)) + ((t-Z) * (t-Z)))) )\nset [distance v] to ([abs v] of (abs distance) )\nif <(distance) < [1]> then\n    switch costume to (costume1 v)\nelse\n    switch costume to (costume2 v)\nend\nset size to ((size) / (distance)) %\nswitch costume to (costume2 v)\ngo to x: ((((t-X) * ([cos v] of (rot-X) )) + ((t-Z) * ([sin v] of (rot-X) ))) / (distance)) y: ((((t-Y) * ([cos v] of (rot-Y) )) + ((((t-X) * ([sin v] of ((rot-X) / (-1)) )) + ((t-Z) * ([cos v] of (rot-X) ))) * ([sin v] of (rot-Y) ))) / (distance))\npoint in direction ((((x position) / (-2000)) * (rot-Y)) + (90))\nswitch costume to (costume)\nset [brightness v] effect to (0)\nif <(abs distance) < [-4.5]> then\n    set [brightness v] effect to (((distance) - (4.5)) * (200))\nend\nif <(abs distance) < [-0.05]> then\n    stamp\nend\npoint in direction (90)\nif <(costume) = [6]> then\n    set [music distance v] to (Distance 2)\n    set [music sine v] to (() - ((((t-X) * ([cos v] of ((rot-X) / (-1)) )) + ((t-Z) * ([sin v] of ((rot-X) / (1)) ))) / (Music Distance)))\n    set [music cos v] to (() - ((((t-X) * ([sin v] of ((rot-X) / (-1)) )) + ((t-Z) * ([cos v] of ((rot-X) / (1)) ))) / (Music Distance)))\n    if <(Music Distance) > [50]> then\n        Add/edit object number [301] to X: ((xp) - (((t-X) / ([sqrt v] of (((t-X) * (t-X)) + ((t-Z) * (t-Z))) )) * ((2) + ((Distance 2) / (200))))) Y: (yp) Z: ((zp) - (((t-Z) / ([sqrt v] of (((t-X) * (t-X)) + ((t-Z) * (t-Z))) )) * ((2) + ((Distance 2) / (200))))) Costume: [6] Size: (size)\n    end\nend\nif <(costume) = [7]> then\n    if <(Distance 2) > [300]> then\n        Add/edit object number [302] to X: (xp) Y: (yp) Z: (zp) Costume: [8] Size: (size)\n    end\nend\n\ndefine Draw Object no. (object number)\nDraw Object at X: (item (object number) of [object x v]) Y: (item (object number) of [object y v]) Z: (item (object number) of [object z v]) Costume: (item (object number) of [object costume v]) Size: (item (object number) of [object size v])\n\ndefine Reset Objects\ndelete all of [object x v]\ndelete all of [object y v]\ndelete all of [object z v]\ndelete all of [object size v]\ndelete all of [object distance v]\ndelete all of [object number v]\ndelete all of [object costume v]\nrepeat (300)\n    Add/edit object number [0] to X: (pick random (-2000) to (2000)) Y: [0] Z: (pick random (-2000) to (2000)) Costume: (pick random (3) to (5)) Size: [100]\nend\nAdd/edit object number [0] to X: [0] Y: [0] Z: [-1000] Costume: [6] Size: [100]\nAdd/edit object number [0] to X: [40] Y: [100] Z: [40] Costume: [7] Size: [100]\n\nAdd/edit object number [0] to X: [-100] Y: [0] Z: [100] Costume: [Abby] Size: [100]\nAdd/edit object number [0] to X: [-100] Y: [0] Z: [-100] Costume: [Abby] Size: [100]\nAdd/edit object number [0] to X: [100] Y: [0] Z: [-100] Costume: [Abby] Size: [100]\nAdd/edit object number [0] to X: [100] Y: [0] Z: [100] Costume: [Abby] Size: [100]\n\ndefine Add/edit object number (no.) to X: (x) Y: (y) Z: (z) Costume: (costume) Size: (size)\nif <[0] < (no.)> then\n    replace item (no.) of [object x v] with (x)\n    replace item (no.) of [object y v] with (y)\n    replace item (no.) of [object z v] with (z)\n    replace item (no.) of [object costume v] with (costume)\n    replace item (no.) of [object size v] with (size)\nelse\n    add (size) to [object size v]\n    add (costume) to [object costume v]\n    add (x) to [object x v]\n    add (y) to [object y v]\n    add (z) to [object z v]\nend\n\ndefine Sort distance and calculate order\ndelete all of [object distance v]\ndelete all of [object number v]\nset [i1 v] to [0]\nrepeat (length of [object costume v])\n    change [i1 v] by (1)\n    set [t-x v] to ((item (i1) of [object x v]) - (x-pos))\n    set [t-y v] to ((item (i1) of [object y v]) - (y-pos))\n    set [t-z v] to ((item (i1) of [object z v]) - (z-pos))\n    if <<<not <([abs v] of (t-X) ) > [1000]>> and <not <([abs v] of (t-Z) ) > [1000]>>> or <(item (i1) of [object costume v]) = [6]>> then\n        set [abs distance v] to ((((((t-X) * ([sin v] of ((rot-X) / (-1)) )) + ((t-Z) * ([cos v] of ((rot-X) / (1)) ))) * ([cos v] of (rot-Y) )) + ((t-Y) * ([sin v] of ((rot-Y) / (-1)) ))) / (-200))\n        if <<<[0.05] < (abs distance)> and <(abs distance) < [5]>> or <(item (i1) of [object costume v]) = [6]>> then\n            Insert distance (abs distance) by numerical order\n        end\n    end\nend\n\ndefine Insert distance (distance) by numerical order\nset [i2 v] to ((length of [object distance v]) + (1))\nrepeat until <<(distance) > (item ((i2) - (1)) of [object distance v])> or <(i2) = [1]>>\n    change [i2 v] by (-1)\nend\ninsert (distance) at (i2) of [object distance v] \ninsert (i1) at (i2) of [object number v] \n\ndefine Draw backdrop\nswitch costume to (costume1 v)\nset size to (220) %\nswitch costume to (sky v)\ngo to x: (0) y: ((rot-Y) * (-4))\nstamp\n\nwhen flag clicked\nforever\n    wait (1) seconds\n    switch costume to (boy v)\n    wait (1) seconds\n    switch costume to (boy2 v)\nend\n\nwhen flag clicked\nforever\n    play sound [Dynimite v] until done\nend\n\nwhen flag clicked\nforever\n    play sound [Dynimite v] until done\nend\n\nwhen flag clicked\nforever\n    play sound [corn full \(1\) v] until done\nend\n\n@Sprite1\n\nwhen flag clicked\nforever\n    set [pan left/right v] effect to ((Music sine) * (-100))\n    set volume to (((100) / ((Music Distance) / (100))) * ((0.8) + ((Music cos) / (5)))) %\nend\n\nwhen flag clicked\nif <key (n v) pressed?> then\n    stop all sounds\nend\n\n@Sprite2\n\nwhen flag clicked\nforever\n    set [pan left/right v] effect to ((Music sine) * (100))\n    set volume to (((500) / ((Music Distance) / (100))) * ((0.8) + ((Music cos) / (5)))) %\nend\n\nwhen flag clicked\nforever\n    play sound [Dynimite v] until done\nend\n\n@maxresdefault (1)\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (100)\nswitch costume to (cover v)\n\nwhen flag clicked\n\nswitch costume to (ending v)\n\n