stats stats stats stats
This commit is contained in:
@@ -32,6 +32,8 @@ func (p *Projectile) Tick(g *game) {
|
||||
collision, _, _ := v.RectIntersection(player_rect, p.Position, v_scaled)
|
||||
if collision {
|
||||
hit_player = true
|
||||
p.Owner.gameStats.Hits++
|
||||
p.Owner.gameStats.DirectHits++
|
||||
|
||||
if r.Health > 0 {
|
||||
// Direct hit causes more damage
|
||||
@@ -39,6 +41,11 @@ func (p *Projectile) Tick(g *game) {
|
||||
|
||||
r.Health -= p.Damage
|
||||
r.Hit = true
|
||||
|
||||
if r.Health <= 0 {
|
||||
r.gameStats.Deaths++
|
||||
p.Owner.gameStats.Kills++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +93,11 @@ func (p *Projectile) Tick(g *game) {
|
||||
r.Health -= p.Damage
|
||||
r.Hit = true
|
||||
}
|
||||
p.Owner.gameStats.Hits++
|
||||
if r.Health <= 0 {
|
||||
r.gameStats.Deaths++
|
||||
p.Owner.gameStats.Kills++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user