alert the robot if it's been hit
This commit is contained in:
parent
082b737805
commit
d2ae3c11d8
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user