bandwidth reduction, filtering explosions and sending objects as [4]int

This commit is contained in:
Fraser Graham
2013-11-16 23:13:03 -08:00
parent 5a2651d0dd
commit 58c084c7ab
4 changed files with 49 additions and 12 deletions
+12 -1
View File
@@ -181,7 +181,7 @@ func (r *Robot) checkCollisions(g *game, move_vector v.Vector2d) (bool, v.Point2
if bot.Id == r.Id {
continue
}
player_rect := v.RectFromPoint(bot.Position, 3)
player_rect := v.RectFromPoint(bot.Position, 5)
collision, _, pos := v.RectIntersection(player_rect, r.Position, move_vector)
if collision {
return collision, pos, bot
@@ -352,6 +352,17 @@ func (r *Robot) scan(g *game) {
}
}
for splo := range g.splosions {
dist := v.Distance(splo.Position, r.Position)
if dist < float32(r.Stats.ScannerRadius+int(r.ScanCounter)) {
s := Scanner{
Id: splo.Id,
Type: "explosion",
}
r.Scanners = append(r.Scanners, s)
}
}
}
func (r *Robot) fire(projectiles map[*Projectile]bool, turn int) *Projectile {