Skip to content

Commit 2ed38d1

Browse files
committed
Fix wrong reached checkpoint count
1 parent 87606b5 commit 2ed38d1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

hoverrace/player.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ func (p *Player) update(delta time.Duration) {
3939
p.move(delta)
4040
p.checkCollisions()
4141

42+
var checkpoints int
43+
if p.game.running {
44+
checkpoints = p.game.config.CheckpointCount - len(p.checkpoints)
45+
}
46+
4247
p.game.hovercrafts[p.id] = Hovercraft{
4348
Pos: p.pos,
44-
Checkpoints: len(p.checkpoints),
49+
Checkpoints: checkpoints,
4550
Velocity: p.vel,
4651
Thrust: p.thrust,
4752
Angle: p.angle,

0 commit comments

Comments
 (0)