improve collision detection
This commit is contained in:
parent
14aabd1b45
commit
e727d74e78
|
@ -22,9 +22,10 @@ func moveBot(b *Bot, s State) {
|
||||||
b.v = -maxV
|
b.v = -maxV
|
||||||
}
|
}
|
||||||
|
|
||||||
newPos := b.Pos + b.v
|
for i := 0; i < b.v; i++ {
|
||||||
if !collide(b.id, newPos, b.Lane, s) {
|
if !collide(b.id, b.Pos+1, b.Lane, s) {
|
||||||
b.Pos = newPos
|
b.Pos++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue