Skip to content

Commit

Permalink
Merge pull request #61 from openbase/bugfix/60-agents-can-shift-out-o…
Browse files Browse the repository at this point in the history
…f-map

Fixed agents leaving map
  • Loading branch information
DivineThreepwood authored Mar 9, 2024
2 parents 49b5731 + ad77eb6 commit 1b12643
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,24 +308,26 @@ class Agent(
// move and apply new direction
moveForward()
direction.apply { directionController() }
if (level.collisionDetected(bounds)) { // Is collied with wall?
kill()
}

// shift
if (isShifting) {
(0..SHIFT_EXTRA_SPEED).forEach { _ ->
if (isCollisionDetected) {
return@performAction
kill()
}
if (consumeTonicForShifting()) {
// move and apply new direction
moveForward()
direction.apply { directionController() }
}
if (level.collisionDetected(bounds)) { // Is collied with wall?
kill()
}
}
}

if (level.collisionDetected(bounds)) { // Is collied with wall?
kill()
}
}
}

Expand Down

0 comments on commit 1b12643

Please sign in to comment.