touch-ups

This commit is contained in:
Luke Meyers 2020-02-07 15:37:31 -08:00
parent 84aa1f8cbe
commit ed6718bd0b
4 changed files with 5 additions and 8 deletions

View File

@ -4,7 +4,7 @@ func chooseCommand(s State, teamID int) command {
t := s.Teams[teamID] t := s.Teams[teamID]
h := t.BatonHolder() h := t.BatonHolder()
if collide(h.Pos+1, h.Lane, s) { if collide(h.Pos+1, h.Lane, s) {
if h.Lane <= t.Lane { if h.Lane <= t.Lane && h.Lane < NumLanes-1 {
return left return left
} }
return right return right

View File

@ -188,7 +188,7 @@ const (
Steps = 60 Steps = 60
numBots = 5 numBots = 5
NumTeams = 4 NumTeams = 4
NumLanes = 6 NumLanes = 4
maxA = 2 maxA = 2
maxV = 8 maxV = 8
) )

View File

@ -27,7 +27,7 @@ func Render(rs RenderState, sOld, sNew game.State, w *pixelgl.Window, d time.Dur
renderObstacles(sNew, w) renderObstacles(sNew, w)
rs.Frame++ rs.Frame++
if rs.Frame >= rs.Frames { if rs.Frame > rs.Frames {
rs.Animating = false rs.Animating = false
} }
return rs return rs
@ -40,8 +40,6 @@ func renderBots(sOld, sNew game.State, tween float64, w *pixelgl.Window, _ time.
for i, t := range sNew.Teams { for i, t := range sNew.Teams {
for j, bot := range t.Bots { for j, bot := range t.Bots {
c := colors[&sNew.Teams[i]] c := colors[&sNew.Teams[i]]
c.R += 0.2 * float64(j)
c.G -= 0.1 * float64(j)
im.Color = c im.Color = c
oldBot := sOld.Teams[i].Bots[j] oldBot := sOld.Teams[i].Bots[j]
@ -113,7 +111,7 @@ func teamColors(ts []game.Team) map[*game.Team]pixel.RGBA {
case 2: case 2:
c = colornames.Lavender c = colornames.Lavender
case 3: case 3:
c = colornames.Indigo c = colornames.Maroon
} }
m[&ts[i]] = pixel.ToRGBA(c) m[&ts[i]] = pixel.ToRGBA(c)
} }

View File

@ -35,7 +35,6 @@ func run() {
Animating: false, Animating: false,
Frames: 20, Frames: 20,
} }
sOld := s sOld := s
for !w.Closed() && !s.GameOver { for !w.Closed() && !s.GameOver {
@ -47,7 +46,7 @@ func run() {
if !rs.Animating { if !rs.Animating {
sOld = s sOld = s
} }
default: case w.Pressed(pixelgl.KeySpace):
rs.Animating = true rs.Animating = true
rs.Frame = 0 rs.Frame = 0
s = game.UpdateState(s, sOld) s = game.UpdateState(s, sOld)