From 14984143570e901fc3d3bd273b0daa3c09bd5bc3 Mon Sep 17 00:00:00 2001 From: Fraser Graham Date: Mon, 28 Oct 2013 23:35:00 -0700 Subject: [PATCH] tweaks in support of better rendering --- game.go | 1 + player.go | 2 +- robot.go | 10 ++++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/game.go b/game.go index fa5ee4e..c3336eb 100644 --- a/game.go +++ b/game.go @@ -249,6 +249,7 @@ func (g *game) run() { log.Printf("game %s: game over", g.id) } p.reset(g) + g.obstacles = GenerateObstacles(5, g.width, g.height) } payload.Reset = true } else { diff --git a/player.go b/player.go index a0f21ae..5bf93f9 100644 --- a/player.go +++ b/player.go @@ -145,7 +145,7 @@ func (p *player) Tick(g *game) { hit_player.Robot.Speed = (hit_player.Robot.Speed * 0.1) 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.Health -= int(p.Robot.Speed / 10.0) diff --git a/robot.go b/robot.go index 47a206f..84585a9 100644 --- a/robot.go +++ b/robot.go @@ -23,10 +23,11 @@ type Robot struct { // This is the subset of data we send to players about robots // that are not theirs. type OtherRobot struct { - Id string `json:"id"` - Name string `json:"name"` - Position v.Point2d `json:"position"` - Health int `json:"health"` + Id string `json:"id"` + Name string `json:"name"` + Position v.Point2d `json:"position"` + Heading v.Vector2d `json:"heading"` + Health int `json:"health"` } func (r Robot) GetTruncatedDetails() OtherRobot { @@ -34,6 +35,7 @@ func (r Robot) GetTruncatedDetails() OtherRobot { Id: r.Id, Name: r.Name, Position: r.Position, + Heading: r.Heading, Health: r.Health, } }