This commit is contained in:
2024-11-08 07:29:34 -05:00
parent 8bf6e56398
commit b4287ad61e
3 changed files with 9 additions and 9 deletions

View File

@@ -368,7 +368,7 @@ func (g *Game) UpdateProjectiles() {
func (g *Game) UpdateTargets() {
for _, target := range g.targets {
if !target.Hit && g.hero.Action < MoverActionDying {
if !target.Hit && g.hero.Action < HeroActionDying {
dx := g.hero.Pos.X - target.Pos.X
dy := g.hero.Pos.Y - target.Pos.Y
angle := math.Atan2(dy, dx)
@@ -380,7 +380,7 @@ func (g *Game) UpdateTargets() {
}
//compute collision with hero
if g.hero.Pos.X >= target.Pos.X-MOVER_WIDTH/2 && g.hero.Pos.X <= target.Pos.X+MOVER_WIDTH/2 && g.hero.Pos.Y >= target.Pos.Y-MOVER_HEIGHT/2 && g.hero.Pos.Y <= target.Pos.Y+MOVER_HEIGHT/2 && target.Action < MoverActionDying && g.hero.Action < MoverActionDying {
if g.hero.Pos.X >= target.Pos.X-MOVER_WIDTH/2 && g.hero.Pos.X <= target.Pos.X+MOVER_WIDTH/2 && g.hero.Pos.Y >= target.Pos.Y-MOVER_HEIGHT/2 && g.hero.Pos.Y <= target.Pos.Y+MOVER_HEIGHT/2 && target.Action < MoverActionDying && g.hero.Action < HeroActionDying {
g.heroCollisionMask.Clear()
g.heroCollisionMask.DrawImage(g.hero.Sprite, nil)