different movement
This commit is contained in:
parent
0926d3fc01
commit
dd0cb76162
1 changed files with 6 additions and 2 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
|
||||||
"drjosh.dev/gurgle/engine"
|
"drjosh.dev/gurgle/engine"
|
||||||
|
"drjosh.dev/gurgle/geom"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Bubble struct {
|
type Bubble struct {
|
||||||
|
@ -27,7 +28,10 @@ func (b *Bubble) Update() error {
|
||||||
if b.Life <= 0 {
|
if b.Life <= 0 {
|
||||||
b.game.Unregister(b)
|
b.game.Unregister(b)
|
||||||
}
|
}
|
||||||
b.Sprite.Actor.MoveX(float64(rand.Intn(3)-1), nil)
|
// not using MoveX/MoveY/... because collisions are unnecessary -
|
||||||
b.Sprite.Actor.MoveY(-1, nil)
|
// this is an effect particle, if it overlaps a solid, who cares
|
||||||
|
b.Sprite.Actor.Pos = b.Sprite.Actor.Pos.Add(geom.Pt3(
|
||||||
|
rand.Intn(3)-1, -1, rand.Intn(2)-1,
|
||||||
|
))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue