Skip to content

Commit

Permalink
Made changes to engineer factory to clean up code for engineer select
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandmcneilly committed Sep 28, 2023
1 parent 4c7fd6e commit bc00c55
Showing 1 changed file with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,8 @@ public static Entity createEngineer() {
Entity engineer = createBaseHumanNPC();
BaseEntityConfig config = configs.engineer;

AnimationRenderComponent animator = new AnimationRenderComponent(
new TextureAtlas("images/engineers/engineer.atlas"));
animator.addAnimation("walk_left", 0.2f, Animation.PlayMode.LOOP);
animator.addAnimation("walk_right", 0.2f, Animation.PlayMode.LOOP);
animator.addAnimation("walk_prep", 0.2f, Animation.PlayMode.LOOP);
animator.addAnimation("idle_right", 0.2f, Animation.PlayMode.LOOP);
animator.addAnimation("firing_auto", 0.05f, Animation.PlayMode.NORMAL);
animator.addAnimation("firing_single", 0.05f, Animation.PlayMode.NORMAL);
animator.addAnimation("prep", 0.05f, Animation.PlayMode.NORMAL);
animator.addAnimation("hit", 0.01f, Animation.PlayMode.NORMAL);
animator.addAnimation("death", 0.1f, Animation.PlayMode.NORMAL);

AITaskComponent aiComponent = new AITaskComponent();
AnimationRenderComponent animator = createAnimationRenderComponent();

engineer
.addComponent(new CombatStatsComponent(config.health, config.baseAttack))
Expand All @@ -76,6 +65,21 @@ public static Entity createEngineer() {
return engineer;
}

private static AnimationRenderComponent createAnimationRenderComponent() {
AnimationRenderComponent animator = new AnimationRenderComponent(
new TextureAtlas("images/engineers/engineer.atlas"));
animator.addAnimation("walk_left", 0.2f, Animation.PlayMode.LOOP);
animator.addAnimation("walk_right", 0.2f, Animation.PlayMode.LOOP);
animator.addAnimation("walk_prep", 0.2f, Animation.PlayMode.LOOP);
animator.addAnimation("idle_right", 0.2f, Animation.PlayMode.LOOP);
animator.addAnimation("firing_auto", 0.05f, Animation.PlayMode.NORMAL);
animator.addAnimation("firing_single", 0.05f, Animation.PlayMode.NORMAL);
animator.addAnimation("prep", 0.05f, Animation.PlayMode.NORMAL);
animator.addAnimation("hit", 0.01f, Animation.PlayMode.NORMAL);
animator.addAnimation("death", 0.1f, Animation.PlayMode.NORMAL);
return animator;
}

/**
* Creates a generic human npc to be used as a base entity by more specific NPC creation methods.
*
Expand Down

0 comments on commit bc00c55

Please sign in to comment.