collisions should kill bubbles

This commit is contained in:
Josh Deprez 2021-10-01 13:18:58 +10:00
parent c551ebd55a
commit df80802307

View file

@ -73,18 +73,10 @@ func (b *Bubble) Update() error {
if b.Life <= 0 { if b.Life <= 0 {
b.game.PathUnregister(b) b.game.PathUnregister(b)
} }
if true { die := func() { b.Life = 0 }
// not using MoveX/MoveY/... because collisions are unnecessary - b.Sprite.Actor.MoveX(float64(rand.Intn(3)-1), die)
// this is an effect particle; if it overlaps a solid, who cares b.Sprite.Actor.MoveY(-1, die)
b.Sprite.Actor.Pos = b.Sprite.Actor.Pos.Add(geom.Pt3( //lint:ignore SA4000 one random minus another is not always zero...
//lint:ignore SA4000 one random minus another is not always zero... b.Sprite.Actor.MoveZ(float64(rand.Intn(2)-rand.Intn(2)), die)
rand.Intn(3)-1, -1, rand.Intn(2)-rand.Intn(2),
))
} else {
b.Sprite.Actor.MoveX(float64(rand.Intn(3)-1), nil)
b.Sprite.Actor.MoveY(-1, nil)
//lint:ignore SA4000 one random minus another is not always zero...
b.Sprite.Actor.MoveZ(float64(rand.Intn(2)-rand.Intn(2)), nil)
}
return nil return nil
} }