collisions should kill bubbles
This commit is contained in:
parent
c551ebd55a
commit
df80802307
1 changed files with 5 additions and 13 deletions
|
@ -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...
|
||||||
rand.Intn(3)-1, -1, rand.Intn(2)-rand.Intn(2),
|
b.Sprite.Actor.MoveZ(float64(rand.Intn(2)-rand.Intn(2)), die)
|
||||||
))
|
|
||||||
} 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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue