diff --git a/player.go b/player.go index 6be3b44..60ec46e 100644 --- a/player.go +++ b/player.go @@ -108,6 +108,7 @@ func (p *player) checkCollisions(g *game, move_vector v.Vector2d) (bool, v.Point func (p *player) Tick(g *game) { p.Robot.Collision = false + p.Robot.Hit = false p.scan(g) // Adjust Speed diff --git a/projectile.go b/projectile.go index 0235333..97c1913 100644 --- a/projectile.go +++ b/projectile.go @@ -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 } } } diff --git a/robot.go b/robot.go index 5165f43..e0e9567 100644 --- a/robot.go +++ b/robot.go @@ -19,6 +19,7 @@ type Robot struct { Scanners []Scanner `json:"scanners"` LastFired int `json:"-"` Collision bool `json:"collision"` + Hit bool `json:"hit"` } // This is the subset of data we send to players about robots