Skip to content

Commit

Permalink
Implemented Fire worm death animation
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniSoda17 committed Sep 19, 2023
1 parent 5f74248 commit 954eb95
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 34 deletions.
110 changes: 83 additions & 27 deletions source/core/assets/images/mobs/fire_worm.atlas
Original file line number Diff line number Diff line change
@@ -1,145 +1,194 @@

fire_worm.png
size: 2048, 128
size: 1024, 256
format: RGBA8888
filter: Nearest, Nearest
repeat: none
fire_worm_attack
rotate: false
xy: 695, 2
xy: 233, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 1080, 2
xy: 387, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 310, 2
xy: 79, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 1542, 2
xy: 618, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 772, 2
xy: 388, 156
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 79, 2
xy: 80, 156
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 1311, 2
xy: 541, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 541, 2
xy: 156, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 1850, 2
xy: 850, 156
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 1157, 2
xy: 464, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 387, 2
xy: 156, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 1696, 2
xy: 695, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 926, 2
xy: 387, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 156, 2
xy: 2, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 1388, 2
xy: 619, 156
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_attack
rotate: false
xy: 618, 2
xy: 233, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_walk
fire_worm_death
rotate: false
xy: 311, 156
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_death
rotate: false
xy: 695, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_death
rotate: false
xy: 2, 156
size: 76, 75
orig: 76, 75
offset: 0, 0
index: -1
fire_worm_death
rotate: false
xy: 79, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_death
rotate: false
xy: 541, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_death
rotate: false
xy: 310, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_death
rotate: false
xy: 1619, 2
xy: 772, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_death
rotate: false
xy: 542, 156
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_walk
rotate: false
xy: 849, 2
xy: 696, 156
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_walk
rotate: false
xy: 2, 2
xy: 310, 2
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_walk
rotate: false
xy: 1234, 2
xy: 2, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
Expand All @@ -153,35 +202,42 @@ fire_worm_walk
index: -1
fire_worm_walk
rotate: false
xy: 1773, 2
xy: 234, 156
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_walk
rotate: false
xy: 1003, 2
xy: 773, 156
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_walk
rotate: false
xy: 233, 2
xy: 465, 156
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_walk
rotate: false
xy: 157, 156
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
fire_worm_walk
rotate: false
xy: 1465, 2
xy: 618, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
index: -1
default
rotate: false
xy: 1465, 2
xy: 618, 79
size: 75, 75
orig: 75, 75
offset: 0, 0
Expand Down
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.
12 changes: 6 additions & 6 deletions source/core/src/main/com/csse3200/game/areas/ForestGameArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private void spawnWave() {
switch (wave) {
case 1:
case 2:
spawnXenoGrunts();
spawnFireWorm();
break;
case 3:
mobBoss2 = spawnMobBoss2();
Expand All @@ -227,7 +227,7 @@ public void create() {

// Set up infrastructure for end game tracking
player = spawnPlayer();
player.getEvents().addListener("spawnWave", this::spawnXenoGrunts);
player.getEvents().addListener("spawnWave", this::spawnFireWorm);

playMusic();

Expand All @@ -241,7 +241,7 @@ public void create() {
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();
spawnFireWorm();
// spawnFireWorm();
spawnWeaponTower();
//mobBoss1 = spawnMobBoss1();
startWaveTimer();
Expand Down Expand Up @@ -481,9 +481,9 @@ private void spawnFireWorm() {
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);
Entity fireWorm = NPCFactory.createFireWorm(player);
fireWorm.setScale(1.5f, 1.5f);
spawnEntityAt(fireWorm, randomPos, true, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public void create() {
animator = this.entity.getComponent(AnimationRenderComponent.class);
entity.getEvents().addListener("wanderStart", this::animateWalk);
entity.getEvents().addListener("shootStart", this::animateAttack);
entity.getEvents().addListener("dieStart", this::animateDeath);
}

void animateWalk() {
Expand All @@ -34,5 +35,11 @@ void animateWalk() {
void animateAttack() {
animator.startAnimation("fire_worm_attack");
}

void animateDeath() {
animator.startAnimation("fire_worm_death");
}


}

Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void updateMobState() {
} else {
Entity newProjectile = ProjectileFactory.createMobBall(PhysicsLayer.HUMANS, new Vector2(0, owner.getEntity().getPosition().y), new Vector2(2f,2f));
newProjectile.setPosition((float) (owner.getEntity().getPosition().x), (float) (owner.getEntity().getPosition().y));
// newProjectile.setScale(-1f, 1f);
newProjectile.setScale(-1f, 1f);
ServiceLocator.getEntityService().register(newProjectile);

// System.out.printf("ANIMATION: " + owner.getEntity().getComponent(AnimationRenderComponent.class).getCurrentAnimation() + "\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public static Entity createFireWorm(Entity target) {
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);
animator.addAnimation("fire_worm_death", 0.1f);
fireWorm
.addComponent(new CombatStatsComponent(config.fullHeath, config.baseAttack, drops, melee, projectiles))
.addComponent(animator)
Expand Down

0 comments on commit 954eb95

Please sign in to comment.