alert the robot if it's been hit

This commit is contained in:
Fraser Graham
2013-11-06 23:06:51 -08:00
parent 082b737805
commit d2ae3c11d8
3 changed files with 4 additions and 4 deletions
+2 -4
View File
@@ -37,6 +37,7 @@ func (p *Projectile) Tick(g *game) {
log.Printf("Direct Hit %v, Dmg:%v", player.Robot.Id, p.Damage)
player.Robot.Health -= p.Damage
player.Robot.Hit = true
}
}
}
@@ -74,12 +75,9 @@ func (p *Projectile) Tick(g *game) {
for player := range g.players {
dist := v.Distance(player.Robot.Position, p.Position)
if dist < float32(p.Radius) {
// TODO map damage Max to Min based on distance from explosion
if player.Robot.Health > 0 {
player.Robot.Health -= p.Damage
if player.Robot.Health <= 0 {
}
player.Robot.Hit = true
}
}
}