Skip to content

Kangaroo Boss Animation

ArthurW4130 edited this page Sep 11, 2024 · 2 revisions

Overview

The kangaroo boss is spawned and animated to perform various moves such as chase, attack, and guard.

There are also some special moves to reinforce the boss's ability and strength.

Overall, since it is the final boss, the kanga boss is agile and developed to have combination of designed moves, This allows the boss to be more difficult to be defeated in combat.

Kanga Boss Animation Implementation

Basic moves such as "chase" and "wander" are implemented in the class named KangaBossAnimationController.

Especially, the Kanga boss will be triggered to chase when the main character comes near.

 void animateWander() {
        animator.startAnimation("float");
    }

    void animateChase() {
        animator.startAnimation("angry_float");
    }

The kanga boss is spawned in the EnemyFactory class, which is responsible for creating non-playable character (NPC) entities.

public static Entity createKangaBossEntity(Entity target) {Entity kangarooBoss = createBossNPC(target);
    BaseEnemyEntityConfig config = configs.kangarooBoss;

    AnimationRenderComponent animator =
            new AnimationRenderComponent(
                    ServiceLocator.getResourceService().getAsset("images/final_boss_kangaroo.atlas", TextureAtlas.class));
    animator.addAnimation("angry_float", 0.1f, Animation.PlayMode.LOOP);
    animator.addAnimation("float", 0.1f, Animation.PlayMode.LOOP);

    List<CombatMove> moveSet = new ArrayList<>(
            Arrays.asList(
                    new AttackMove("Kanga Attack", 10),
                    new GuardMove("Kanga Guard", 5),
                    new SleepMove("Kanga Sleep", 0),
                    new SpecialKangaMove("Kanga Special", 25)
            )
    );

    kangarooBoss
            .addComponent(new CombatStatsComponent(config.getHealth(), config.getHunger(), config.getBaseAttack(), config.getDefense(), config.getSpeed(), config.getExperience(), 100, false))
            .addComponent(new CombatMoveComponent(moveSet))
            .addComponent(animator)
            .addComponent(new KangaBossAnimationController());

    kangarooBoss.getComponent(AnimationRenderComponent.class).scaleEntity();
    kangarooBoss.scaleHeight(3.0f);

    return kangarooBoss;
  } 
Clone this wiki locally