Rendering updates

This commit is contained in:
Luke Meyers 2020-02-05 21:38:46 -08:00
parent 0a41558c72
commit b113d52f66
2 changed files with 6 additions and 2 deletions

View File

@ -143,6 +143,7 @@ const (
Steps = 50
numBots = 5
NumTeams = 2
NumLanes = 4
maxA = 3
maxV = 10
)

View File

@ -23,7 +23,10 @@ func renderBots(s game.State, w *pixelgl.Window, d time.Duration, colors map[*ga
for i, t := range s.Teams {
for j, bot := range t.Bots {
im.Color = colors[&s.Teams[i]]
c := colors[&s.Teams[i]]
c.R += 0.2 * float64(j)
c.G -= 0.1 * float64(j)
im.Color = c
pos := lanePos(bot.Pos, bot.Lane, botWidth, bounds)
@ -51,7 +54,7 @@ func renderBaton(pos pixel.Vec, w *pixelgl.Window) {
func lanePos(pos, lane int, width float64, bounds pixel.Rect) pixel.Vec {
hOffset := bounds.Size().X / game.Steps
vOffset := bounds.Size().Y / (game.NumTeams + 1)
vOffset := bounds.Size().Y / (game.NumLanes + 1)
return pixel.V(bounds.Min.X+width/2+float64(pos)*hOffset,
bounds.Min.Y+float64(lane+1)*vOffset)