From 235fc1ce6f6ba42ac6089c7f9450f45c1f1a63a0 Mon Sep 17 00:00:00 2001 From: Fraser Graham Date: Mon, 28 Oct 2013 07:54:49 -0700 Subject: [PATCH] fixed projectile explosions pos --- projectile.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projectile.go b/projectile.go index f5871fc..3515525 100644 --- a/projectile.go +++ b/projectile.go @@ -35,15 +35,18 @@ func (p *Projectile) Tick(g *game) { r_dest := v.RectFromPoint(p.MoveTo, 3.0) travel := newPos.Sub(p.Position) - arrived, _, _ := v.RectIntersection(r_dest, p.Position, travel) + arrived, _, pos := v.RectIntersection(r_dest, p.Position, travel) if !arrived { for _, obj := range g.obstacles { - collision, _, _ := v.RectIntersection(obj.Bounds, p.Position, travel) + collision, _, pos := v.RectIntersection(obj.Bounds, p.Position, travel) if collision { arrived = true + p.Position = pos } } + } else { + p.Position = pos } if arrived || hit_player {