Skip to content

Commit

Permalink
Added the fireworm walk and attack animation
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniSoda17 committed Sep 19, 2023
1 parent 3e0d12f commit 5f74248
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 31 deletions.
43 changes: 25 additions & 18 deletions source/core/assets/images/mobs/fire_worm.atlas
Original file line number Diff line number Diff line change
Expand Up @@ -4,112 +4,112 @@ size: 2048, 128
format: RGBA8888
filter: Nearest, Nearest
repeat: none
fire_worm_attack1
fire_worm_attack
rotate: false
xy: 695, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack10
fire_worm_attack
rotate: false
xy: 1080, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack11
fire_worm_attack
rotate: false
xy: 310, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack12
fire_worm_attack
rotate: false
xy: 1542, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack13
fire_worm_attack
rotate: false
xy: 772, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack14
fire_worm_attack
rotate: false
xy: 2, 2
xy: 79, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack15
fire_worm_attack
rotate: false
xy: 1311, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack16
fire_worm_attack
rotate: false
xy: 541, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack2
fire_worm_attack
rotate: false
xy: 1850, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack3
fire_worm_attack
rotate: false
xy: 1157, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack4
fire_worm_attack
rotate: false
xy: 387, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack5
fire_worm_attack
rotate: false
xy: 1696, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack6
fire_worm_attack
rotate: false
xy: 926, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack7
fire_worm_attack
rotate: false
xy: 156, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack8
fire_worm_attack
rotate: false
xy: 1388, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack9
fire_worm_attack
rotate: false
xy: 618, 2
size: 75, 75
Expand All @@ -132,7 +132,7 @@ fire_worm_walk
index: -1
fire_worm_walk
rotate: false
xy: 79, 2
xy: 2, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
Expand Down Expand Up @@ -179,3 +179,10 @@ fire_worm_walk
orig: 75, 75
offset: 0, 0
index: -1
default
rotate: false
xy: 1465, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
Binary file modified source/core/assets/images/mobs/fire_worm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions source/core/src/main/com/csse3200/game/areas/ForestGameArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public class ForestGameArea extends GameArea {
"images/projectiles/stun_effect.png",
"images/projectiles/firework_anim.png",
"images/projectiles/pierce_anim.png",
"images/projectiles/snow_ball.png"
"images/projectiles/snow_ball.png",
"images/mobs/fire_worm.png"
};
private static final String[] forestTextureAtlases = {
"images/economy/econ-tower.atlas",
Expand Down Expand Up @@ -136,7 +137,8 @@ public class ForestGameArea extends GameArea {
"images/projectiles/burn_effect.atlas",
"images/projectiles/firework_anim.atlas",
"images/projectiles/mobProjectile.atlas",
"images/projectiles/stun_effect.atlas"
"images/projectiles/stun_effect.atlas",
"images/mobs/fire_worm.atlas"
};
private static final String[] forestSounds = {
"sounds/Impact4.ogg",
Expand Down Expand Up @@ -238,7 +240,8 @@ public void create() {
spawnRicochetFireball(new Vector2(2, 4), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f));
spawnSplitFireWorksFireBall(new Vector2(2, 5), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f), 12);
spawnEffectProjectile(new Vector2(2, 6), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f), ProjectileEffects.SLOW, false);
spawnXenoGrunts();
// spawnXenoGrunts();
spawnFireWorm();
spawnWeaponTower();
//mobBoss1 = spawnMobBoss1();
startWaveTimer();
Expand Down Expand Up @@ -472,6 +475,18 @@ private void spawnXenoGrunts() {
}
}

private void spawnFireWorm() {
int[] pickedLanes = new Random().ints(1, 7)
.distinct().limit(5).toArray();
for (int i = 0; i < NUM_GRUNTS; i++) {
GridPoint2 randomPos = new GridPoint2(19, pickedLanes[i]);
System.out.println(randomPos);
Entity xenoGrunt = NPCFactory.createFireWorm(player);
xenoGrunt.setScale(1.5f, 1.5f);
spawnEntityAt(xenoGrunt, randomPos, true, false);
}
}

// private Entity spawnGhostKing() {
// GridPoint2 minPos = new GridPoint2(0, 0);
// GridPoint2 maxPos = terrain.getMapBounds(0).sub(0, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void animateWalk() {
}

void animateAttack() {
animator.startAnimation("xeno_shoot");
animator.startAnimation("fire_worm_attack");
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.csse3200.game.ai.tasks.AITaskComponent;
import com.csse3200.game.components.CombatStatsComponent;
import com.csse3200.game.components.TouchAttackComponent;
import com.csse3200.game.components.npc.FireWormAnimationController;
import com.csse3200.game.components.npc.GhostAnimationController;
import com.csse3200.game.components.npc.XenoAnimationController;
import com.csse3200.game.components.tasks.MobAttackTask;
Expand Down Expand Up @@ -97,7 +98,7 @@ public static Entity createGhostKing(Entity target) {
}

/**
* Creates a xeno grunt entity.
* Creates a fire worm entity.
*
* @param target entity to chase
* @return entity
Expand All @@ -112,23 +113,21 @@ public static Entity createFireWorm(Entity target) {

AnimationRenderComponent animator =
new AnimationRenderComponent(
ServiceLocator.getResourceService().getAsset("images/mobs/xenoGrunt.atlas", TextureAtlas.class));
animator.addAnimation("xeno_run", 0.1f, Animation.PlayMode.LOOP);
animator.addAnimation("xeno_hurt", 0.1f, Animation.PlayMode.LOOP);
animator.addAnimation("xeno_shoot", 0.1f);
animator.addAnimation("xeno_melee_1", 0.1f);
animator.addAnimation("xeno_melee_2", 0.1f);
animator.addAnimation("xeno_die", 0.1f);
ServiceLocator.getResourceService().getAsset("images/mobs/fire_worm.atlas", TextureAtlas.class));
animator.addAnimation("fire_worm_walk", 0.1f, Animation.PlayMode.LOOP);
animator.addAnimation("fire_worm_attack", 0.1f);
fireWorm
.addComponent(new CombatStatsComponent(config.fullHeath, config.baseAttack, drops, melee, projectiles))
.addComponent(animator)
.addComponent(new XenoAnimationController());
.addComponent(new FireWormAnimationController());

fireWorm.getComponent(HitboxComponent.class).setAsBoxAligned(new Vector2(.3f, .5f), PhysicsComponent.AlignX.RIGHT, PhysicsComponent.AlignY.BOTTOM);
fireWorm.getComponent(AnimationRenderComponent.class).scaleEntity();

return fireWorm;
}


/**
* Creates a xeno grunt entity.
*
Expand Down

0 comments on commit 5f74248

Please sign in to comment.