probe result

This commit is contained in:
Fraser Graham
2013-11-07 08:41:39 -08:00
committed by Fraser Graham
parent 829ba83f41
commit eabc1ebb41
2 changed files with 4 additions and 2 deletions
+3 -2
View File
@@ -66,6 +66,7 @@ func (p *player) recv() {
if msg.Probe != nil {
p.Robot.Probe = msg.Probe
p.Robot.ProbeResult = nil
} else {
p.Robot.Probe = nil
}
@@ -204,11 +205,11 @@ func (p *player) Tick(g *game) {
}
}
if p.Robot.Probe != nil {
if p.Robot.Probe != nil && p.Robot.ProbeResult == nil {
probe_vector := p.Robot.Probe.Sub(p.Robot.Position)
coll, pos, _ := p.checkCollisions(g, probe_vector)
if coll {
p.Robot.Probe = &pos
p.Robot.ProbeResult = &pos
}
}
}
+1
View File
@@ -21,6 +21,7 @@ type Robot struct {
Collision bool `json:"collision"`
Hit bool `json:"hit"`
Probe *v.Point2d `json:"probe"`
ProbeResult *v.Point2d `json:"probe_result"`
}
// This is the subset of data we send to players about robots