Skip to content

Companion Modes Feature

atharvagupta2003 edited this page Oct 4, 2023 · 4 revisions

#Overview The Companion Modes feature enhances gameplay by allowing the in-game companion to adapt to different roles. The companion can operate in three distinct modes: Normal Mode, Attack Mode, and Defense Mode. Each mode provides unique behaviors and capabilities to assist the player.

Usage

Players can switch between companion modes during gameplay to suit different situations or strategies. Typically, the mode switch is activated by pressing a designated button, offering real-time flexibility.

Companion Modes

Normal Mode

In Normal Mode, the companion primarily follows the player character. This mode is suitable for exploration and general gameplay. The companion provides no additional offensive or defensive capabilities.

Attack Mode

Attack Mode equips the companion with offensive abilities. In this mode, the companion throws potions as weapons, targeting enemies. The companion's actions contribute to attacking and defeating foes effectively.

Defense Mode

In Defense Mode, the companion's focus shifts to defense and protection. A shield or protective barrier appears, defending both the player and the companion from enemy attacks. This mode is ideal for surviving tough battles or situations where defense is critical.

Constructor

The CompanionActions class constructor initializes the companion's action component, handling various behaviors related to the companion's actions, including movement, mode switching, and attacking.

Methods

setCompanionMode(String mode)

  • Set the companion mode to one of three available modes: Normal, Defense, or Attack.

  • mode (String): The mode to set the companion to (Normal, Defense, or Attack).

CompanionSwitchMode()

Toggle between the available companion modes in a cycle: Normal -> Defense -> Attack -> Normal. This method allows the player to switch between modes during gameplay.

isCompanionBeingMoved()

Check if the companion is currently being moved. Returns true if the companion is being moved and false otherwise.

updateSpeed()

Update the companion's speed and movement direction based on player input. This method ensures the companion follows the player and adjusts its speed as needed.

Dependencies

LibGDX: A versatile cross-platform game development framework used to implement and manage game functionality.

PhysicsComponent: Provides the necessary physics behaviors for the companion entity.

ServiceLocator: A central service for resource management and game-related services.

Clone this wiki locally