Refactoring in explosion sounds.

This commit is contained in:
diego committed 2024-11-15 16:46:20 -05:00
1 parent cbc4ba5eb3
commit a4a532edec
3 files changed
+19

No files matched your search

+7
View File
@@ -327,6 +327,13 @@ func (c *Canvas) UpdateEnemies() {
for _, e := range c.enemies {
if !c.gameover {
e.SetTarget(c.hero.Pos)
if e.GetEnemyState() == gamedata.EnemyStateExploding && !e.ExplosionInitiated() {
if c.eventmap[gamedata.GameEventExplosion] != nil {
c.eventmap[gamedata.GameEventExplosion]()
}
e.SetExplosionInitiated()
}
} else {
e.SetTarget(e.GetPosition())
}