PlayerMovementUseCase

scalata.application.usecases.playerusecases.PlayerMovementUseCase

Handles a single movement command issued by the player.

==== Decision tree ====

  • Simple step – if the target tile lies inside the current room and is free of living enemies/items, update the player’s position.

  • Door transition – when the tile matches the current door and the room contains an exit in that direction, move the player to the neighbouring room, advance GameState.currentRoom and push any enemy standing on the entrance one tile inward.

  • Invalid – in all other cases return GameError.InvalidInput.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def execute(direction: Direction, gameSession: GameSession): GameResult[GameSession]

Attempt to move the player one tile towards direction.

Attempt to move the player one tile towards direction.

Value parameters

direction

cardinal step requested by the user

gameSession

immutable snapshot before the move

Attributes

Returns

updated session wrapped in GameResult.success or a GameResult.error when the move is illegal

Definition Classes