tweaks in support of better rendering

This commit is contained in:
Fraser Graham 2013-10-28 23:35:00 -07:00
parent a4b539e79d
commit 1498414357
3 changed files with 8 additions and 5 deletions

View File

@ -249,6 +249,7 @@ func (g *game) run() {
log.Printf("game %s: game over", g.id) log.Printf("game %s: game over", g.id)
} }
p.reset(g) p.reset(g)
g.obstacles = GenerateObstacles(5, g.width, g.height)
} }
payload.Reset = true payload.Reset = true
} else { } else {

View File

@ -145,7 +145,7 @@ func (p *player) Tick(g *game) {
hit_player.Robot.Speed = (hit_player.Robot.Speed * 0.1) hit_player.Robot.Speed = (hit_player.Robot.Speed * 0.1)
hit_player.Robot.Heading = p.Robot.Heading hit_player.Robot.Heading = p.Robot.Heading
} }
move_by := intersection_point.Sub(p.Robot.Position).Scale(0.95) move_by := intersection_point.Sub(p.Robot.Position).Scale(0.9)
p.Robot.Position = p.Robot.Position.Add(move_by) p.Robot.Position = p.Robot.Position.Add(move_by)
p.Robot.Health -= int(p.Robot.Speed / 10.0) p.Robot.Health -= int(p.Robot.Speed / 10.0)

View File

@ -26,6 +26,7 @@ type OtherRobot struct {
Id string `json:"id"` Id string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Position v.Point2d `json:"position"` Position v.Point2d `json:"position"`
Heading v.Vector2d `json:"heading"`
Health int `json:"health"` Health int `json:"health"`
} }
@ -34,6 +35,7 @@ func (r Robot) GetTruncatedDetails() OtherRobot {
Id: r.Id, Id: r.Id,
Name: r.Name, Name: r.Name,
Position: r.Position, Position: r.Position,
Heading: r.Heading,
Health: r.Health, Health: r.Health,
} }
} }