From: Jason Woofenden Date: Mon, 2 Apr 2007 22:44:12 +0000 (-0400) Subject: pixels push rocks with their difference in speed, not their absolute velocity X-Git-Tag: 0.5.3~7 X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=commitdiff_plain;h=941aee9daf4b4cfb337fbf9688876e86c3b0b001 pixels push rocks with their difference in speed, not their absolute velocity --- diff --git a/main.c b/main.c index c90a793..1bb6bc1 100644 --- a/main.c +++ b/main.c @@ -270,11 +270,11 @@ move_dot(struct dot *d) d->active = 0; else { hit = pixel_collides(d->x, d->y); - if(hit && hit->type != SHIP) { + if(hit) if(hit->type != SHIP) { d->active = 0; mass = sprite_mass(hit); - hit->dx += DOT_MASS_UNIT * d->mass * d->dx / mass; - hit->dy += DOT_MASS_UNIT * d->mass * d->dy / mass; + hit->dx += DOT_MASS_UNIT * d->mass * (d->dx - hit->dx) / mass; + hit->dy += DOT_MASS_UNIT * d->mass * (d->dy - hit->dy) / mass; } } }