Use mouse clicks to place planets and modify the orbit of yours. Speed it up much as you can without making it exit the game boundaries. MAX is your actual score: the maximum velocity reached.

This is my second entry for the 2020 TweetTweetJam 4, a canvas game in 499 byte.

Source:

<canvas id=c><<script>m=e=>{X.push(e.x-10);Y.push(e.y-10)};i=Math;X=[];Y=[];c=c.getContext('2d');h=x=150;y=75;M=0;z=0;k=0;t=setInterval(()=>{with(c){onmousedown=m;fillStyle='#22222220';fillRect(0,0,300,h);for(j=0;j<X.length;j++){d=X[j]-x+.1;z+=i.sign(d)*6e-3/d*d;d=Y[j]-y+.1;k+=i.sign(d)*6e-3/d*d;fillStyle='#cc0';fillRect(X[j],Y[j],3,3)}x+=z;y+=k;fillStyle='#fff';fillRect(x,y,5,5);v=i.sqrt(z*z+k*k)*10;M=v>M?v|0:M;fillText("MAX: "+M,5,19);!(x>0&&x<300&&y>0&&y<h)&&clearInterval(t)}},16);</script>
StatusReleased
PlatformsHTML5
Rating
Rated 5.0 out of 5 stars
(2 total ratings)
AuthorLuca Giacometti
GenreAction
TagsGravity, Physics, planets, Relaxing, Space, Space Sim

Comments

Log in with itch.io to leave a comment.

Hey! I like this. Especially given the size constraint. It made me want to add/change things (and try HTML canvas). So I made another version without the size constraint and added a couple things.

You can try it there: https://shadelight777.itch.io/gravity-2

NIIIICE! Good job!

Figured out the ultimate strategeye

WOW! Great job!

Fantastic job. Really impressive. I found an important strategy is to concentrate planets in a single area to increase the gravitational pull of that one spot.

Yep, but after a while you'll go out of bounds ... think of it as a black hole.

Very attractive physics game. Shadowing effect is very cool! I just fiddled with source code (sorry) and added more cross-platformability and some shortage. The mechanics and appearance remained exactly the same:

<canvas id=c><script>i=Math;X=[];Y=[];c=c.getContext`2d`;h=x=150;y=75;M=z=k=0;onclick=e=>{X.push(e.x-10);Y.push(e.y-10)};t=setInterval(e=>{with(c){fillStyle='#2221';fillRect(0,0,300,h);for(j=0;j<X.length;j++){d=X[j]-x+.1;z+=i.sign(d)*6e-3/d*d;d=Y[j]-y+.1;k+=i.sign(d)*6e-3/d*d;fillStyle='#cc0';fillRect(X[j],Y[j],3,3)}fillStyle='#fff';fillRect(x+=z,y+=k,5,5);v=i.sqrt(z*z+k*k)*10;M=v>M?v|0:M;fillText("MAX: "+M,5,19);if(x<0||x>300||y<0||y>h)clearInterval(t)}},16);</script>

WOW ... Also 476 byte! GREAT JOB, THANKS!