bandwidth reduction, filtering explosions and sending objects as [4]int
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user