JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
pixels push rocks with their difference in speed, not their absolute velocity
authorJason Woofenden <jason183@herkamire.com>
Mon, 2 Apr 2007 22:44:12 +0000 (18:44 -0400)
committerJason Woofenden <jason183@herkamire.com>
Mon, 2 Apr 2007 22:44:12 +0000 (18:44 -0400)
main.c

diff --git a/main.c b/main.c
index c90a793..1bb6bc1 100644 (file)
--- 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;
                        }
                }
        }