Skip to content

Companion Down Mode

Maxwell Schroder edited this page Oct 19, 2023 · 1 revision

Companion Down Mode

The companion down mode is added inside of the companion modes

Class Overview

  • Package: com.csse3200.game.components.Companion.CompanionActions
  • Inherits From: Component

Companion down mode is a state of MODE where the companion keyboard is no longer active, it is not animated, and only a selective number of powerups can be used. This is to add value to the companion in its overall game use.

Fields

  • String COMPANION_MODE_DOWN: The string storing the down mode

Methods

  • handleCompanionDownMode() : Handles all the parts of the companion going down

      // Set animation of companion to be facing down
      entity.getComponent(CompanionAnimationController.class).animateDown();
      // Set the mode to be in down mode
      setCompanionMode(COMPANION_MODE_DOWN);
    
      // Send updated mode to the UI
      entity.getEvents().trigger("companionModeChange","Down");
    
      // set follow speed to zero
      entity.getComponent(FollowComponent.class).setFollowSpeed(0f);
    
      //OPTIONAL _ MUST IMPLEMENT: trigger death animation
      entity.getEvents().trigger("companionDeath");
      entity.getEvents().trigger("standUp");
    

Other classes impacted

In KeyboardCompanionInputComponent.class You cannot press down (and subsequently make any companion specific actions) if you are in down mode

@Override
public boolean keyDown(int keycode) {
    // check if the companion is in down mode
    if (!Objects.equals(entity.getComponent(CompanionActions.class).getCompanionMode(), "COMPANION_MODE_DOWN")) {

...

Clone this wiki locally