Archer - UQdeco2800/2022-studio-3 GitHub Wiki
Archer
General Info
The archer is a long-ranged unit with high attack points but is very fragile to enemies' attacks. This unit is best suited for the backline so that they can attack the opposing units, or otherwise, they will get eliminated very quickly.
Unit stats (Pending)
Made in: Building
Costs 15 wood
Troops: 4
Attack: 5
Defence: 1
Health: 20
Movement speed: 1
Sprites Design
The following archer designs were initially designed to match the top-down view map but were then changed into the designs in the next section.
However, as there were some changes to the map and building designs, huge changes, such as isometric perspective and design style, were made in order to match the design with other features.
The following images are the updated sprites sheets for the archer unit:
- Walking
- Attacking
The following sprite sheet includes all the animation for every direction, including when the unit is being highlighted:
Archer Animation
For the fourth sprint, team 8 worked on creating an animation for the archer. The ArcherFactory creates a static entity archer which is capable of shooting arrows at a target. A sprite for the static archer was created using previously created archer sprites. Since an archer is a type of friendly unit which is used in long - range combat situations, it was created to be a static entity.
The following code implements the use of the ArcherFactory:
public static Entity createArcher(Entity target, GameArea gameArea) {
Entity archer1 = new Entity()
.addComponent(new PhysicsComponent())
.addComponent(new PhysicsMovementComponent())
.addComponent(new ColliderComponent())
.addComponent(new HitboxComponent().setLayer(PhysicsLayer.SOLDIER))
.addComponent(new FriendlyComponent())
.addComponent(new HealthBarComponent(EntityType.FRIENDLY));
AITaskComponent aiComponent = new AITaskComponent()
.addTask(new rangedAttackTask(target, 4, 10, 2000f));
archer1.addComponent(new TextureRenderComponent("images/archerstatic.png"))
.addComponent(new CombatStatsComponent(stats.health, stats.baseAttack, stats.baseDefence))
.addComponent(aiComponent)
.addComponent(new AttackListener(target, gameArea));
archer1.scaleHeight(0.8f);
archer1.scaleWidth(0.5f);
return archer1;
}
The archer entity uses the rangedAttackTask to animate the arrow, which was designed specifically for the archer. The arrow is shown as below.
When spawned, the visual appreance of the archer shooting arrows at the target is observed.