Decoupled death animation from draw thread.
This commit is contained in:
7
mover.go
7
mover.go
@@ -134,7 +134,7 @@ func (m *Mover) Draw() {
|
|||||||
m.Sprite.DrawImage(shadow, op)
|
m.Sprite.DrawImage(shadow, op)
|
||||||
m.Sprite.DrawImage(flyeyeImage2.SubImage(image.Rect(x0, y0, x1, y1)).(*ebiten.Image), nil)
|
m.Sprite.DrawImage(flyeyeImage2.SubImage(image.Rect(x0, y0, x1, y1)).(*ebiten.Image), nil)
|
||||||
case MoverActionDying:
|
case MoverActionDying:
|
||||||
m.dyingcount++
|
|
||||||
if (m.cycles/5)%2 == 0 {
|
if (m.cycles/5)%2 == 0 {
|
||||||
|
|
||||||
m.MaksDest.DrawImage(flyeyeImage2.SubImage(image.Rect(x0, y0, x1, y1)).(*ebiten.Image), nil)
|
m.MaksDest.DrawImage(flyeyeImage2.SubImage(image.Rect(x0, y0, x1, y1)).(*ebiten.Image), nil)
|
||||||
@@ -147,7 +147,7 @@ func (m *Mover) Draw() {
|
|||||||
} else {
|
} else {
|
||||||
m.Sprite.DrawImage(flyeyeImage2.SubImage(image.Rect(x0, y0, x1, y1)).(*ebiten.Image), nil)
|
m.Sprite.DrawImage(flyeyeImage2.SubImage(image.Rect(x0, y0, x1, y1)).(*ebiten.Image), nil)
|
||||||
}
|
}
|
||||||
if m.dyingcount > 60 {
|
if m.dyingcount >= 31 {
|
||||||
m.cycles = 0
|
m.cycles = 0
|
||||||
m.SetHit()
|
m.SetHit()
|
||||||
}
|
}
|
||||||
@@ -172,6 +172,9 @@ func (m *Mover) Update() {
|
|||||||
m.Angle = float64(m.cycles) / (math.Pi * 2)
|
m.Angle = float64(m.cycles) / (math.Pi * 2)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
if m.Action == MoverActionDying {
|
||||||
|
m.dyingcount++
|
||||||
|
}
|
||||||
m.cycles++
|
m.cycles++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user