tweaks in support of better rendering
This commit is contained in:
parent
a4b539e79d
commit
1498414357
1
game.go
1
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 {
|
||||
|
@ -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)
|
||||
|
10
robot.go
10
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,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user