fixed projectile explosions pos
This commit is contained in:
parent
5c77e373c3
commit
235fc1ce6f
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user