Skip to content

Commit

Permalink
Corrected animation lengths for fireTowers and stunTowers.
Browse files Browse the repository at this point in the history
  • Loading branch information
shiv-0831 committed Sep 8, 2023
1 parent 4bbef11 commit 4441a3b
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 105 deletions.
92 changes: 46 additions & 46 deletions source/core/assets/images/towers/fire_tower_atlas.atlas
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@

fire_tower_atlas.png
size: 2048, 256
size: 1024, 64
format: RGBA8888
filter: Nearest, Nearest
repeat: none
attac_prep
rotate: false
xy: 2, 2
size: 159, 150
orig: 159, 150
offset: 0, 0
index: 2
attack
rotate: false
xy: 467, 2
size: 150, 150
orig: 150, 150
xy: 122, 2
size: 58, 58
orig: 58, 58
offset: 0, 0
index: 1
attack
rotate: false
xy: 923, 2
size: 150, 150
orig: 150, 150
xy: 302, 2
size: 58, 58
orig: 58, 58
offset: 0, 0
index: 3
attack
rotate: false
xy: 1075, 2
size: 150, 150
orig: 150, 150
xy: 422, 2
size: 58, 58
orig: 58, 58
offset: 0, 0
index: 0
attack
rotate: false
xy: 1379, 2
size: 150, 150
orig: 150, 150
xy: 602, 2
size: 58, 58
orig: 58, 58
offset: 0, 0
index: 2
attack_prep
rotate: false
xy: 315, 2
size: 150, 150
orig: 150, 150
offset: 0, 0
index: 0
idle
rotate: false
xy: 163, 2
size: 150, 150
orig: 150, 150
offset: 0, 0
index: 1
attack_prep
rotate: false
xy: 163, 2
size: 150, 150
orig: 150, 150
xy: 62, 2
size: 58, 58
orig: 58, 58
offset: 0, 0
index: 1
idle
rotate: false
xy: 619, 2
size: 150, 150
orig: 150, 150
xy: 182, 2
size: 58, 58
orig: 58, 58
offset: 0, 0
index: 3
idle
rotate: false
xy: 771, 2
size: 150, 150
orig: 150, 150
xy: 362, 2
size: 58, 58
orig: 58, 58
offset: 0, 0
index: 0
idle
rotate: false
xy: 1227, 2
size: 150, 150
orig: 150, 150
xy: 542, 2
size: 58, 58
orig: 58, 58
offset: 0, 0
index: 2
prep_attack
rotate: false
xy: 2, 2
size: 58, 58
orig: 58, 58
offset: 0, 0
index: 1
prep_attack
rotate: false
xy: 242, 2
size: 58, 58
orig: 58, 58
offset: 0, 0
index: 0
prep_attack
rotate: false
xy: 482, 2
size: 58, 58
orig: 58, 58
offset: 0, 0
index: 2
Binary file modified source/core/assets/images/towers/fire_tower_atlas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 49 additions & 49 deletions source/core/assets/images/towers/stun_tower.atlas
Original file line number Diff line number Diff line change
Expand Up @@ -7,112 +7,112 @@ repeat: none
attack
rotate: false
xy: 2, 2
size: 65, 45
orig: 65, 45
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 4
attack
rotate: false
xy: 136, 2
size: 65, 45
orig: 65, 45
xy: 116, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 9
attack
rotate: false
xy: 203, 2
size: 65, 45
orig: 65, 45
xy: 173, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 1
attack
rotate: false
xy: 270, 2
size: 65, 45
orig: 65, 45
xy: 230, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 6
attack
rotate: false
xy: 404, 2
size: 65, 45
orig: 65, 45
xy: 344, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 3
attack
rotate: false
xy: 538, 2
size: 65, 45
orig: 65, 45
xy: 458, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 8
attack
rotate: false
xy: 672, 2
size: 65, 45
orig: 65, 45
xy: 572, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 0
attack
rotate: false
xy: 739, 2
size: 65, 45
orig: 65, 45
xy: 629, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 5
attack
rotate: false
xy: 873, 2
size: 65, 45
orig: 65, 45
xy: 743, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 2
attack
rotate: false
xy: 940, 2
size: 65, 45
orig: 65, 45
xy: 800, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 7
idle
rotate: false
xy: 69, 2
size: 65, 45
orig: 65, 45
xy: 59, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 1
idle
rotate: false
xy: 337, 2
size: 65, 45
orig: 65, 45
xy: 287, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 3
idle
rotate: false
xy: 471, 2
size: 65, 45
orig: 65, 45
xy: 401, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 0
idle
rotate: false
xy: 605, 2
size: 65, 45
orig: 65, 45
xy: 515, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 5
idle
rotate: false
xy: 605, 2
size: 65, 45
orig: 65, 45
xy: 686, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 4
index: 2
idle
rotate: false
xy: 806, 2
size: 65, 45
orig: 65, 45
xy: 857, 2
size: 55, 45
orig: 55, 45
offset: 0, 0
index: 2
index: 4
Binary file modified source/core/assets/images/towers/stun_tower.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions source/core/src/main/com/csse3200/game/areas/ForestGameArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import com.csse3200.game.components.gamearea.GameAreaDisplay;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;

Expand Down Expand Up @@ -394,15 +396,16 @@ private void spawnWeaponTower() {
GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2);

for (int i = 0; i < NUM_WEAPON_TOWERS; i++) {
GridPoint2 randomPos = RandomUtils.random(minPos, maxPos);
GridPoint2 randomPos1 = RandomUtils.random(minPos, maxPos);
GridPoint2 randomPos2 = RandomUtils.random(minPos, maxPos);
//Entity weaponTower = TowerFactory.createWeaponTower();
Entity wallTower = TowerFactory.createWallTower();
Entity fireTower = TowerFactory.createFireTower();
Entity stunTower = TowerFactory.createStunTower();
//spawnEntityAt(weaponTower, randomPos, true, true);
spawnEntityAt(fireTower, randomPos, true, true);
spawnEntityAt(stunTower, randomPos, true, true);
spawnEntityAt(wallTower, new GridPoint2(randomPos.x + 3, randomPos.y), true, true);
spawnEntityAt(fireTower, randomPos1, true, true);
spawnEntityAt(stunTower, randomPos2, true, true);
//spawnEntityAt(wallTower, new GridPoint2(randomPos1.x + 3, randomPos1.y), true, true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public void updateTowerState() {
owner.getEntity().getEvents().trigger(ATTACK);
Entity newProjectile = ProjectileFactory.createFireBall(owner.getEntity(),
new Vector2(100, owner.getEntity().getPosition().y), new Vector2(2f, 2f));
newProjectile.setPosition((float) (owner.getEntity().getPosition().x + 0.75),
(float) (owner.getEntity().getPosition().y + 0.75));
newProjectile.setPosition((float) (owner.getEntity().getPosition().x + 0.25),
(float) (owner.getEntity().getPosition().y + 0.25));
ServiceLocator.getEntityService().register(newProjectile);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public void updateTowerState() {
owner.getEntity().getEvents().trigger(ATTACK);
Entity newProjectile = ProjectileFactory.createFireBall(owner.getEntity(),
new Vector2(100, owner.getEntity().getPosition().y), new Vector2(2f, 2f));
newProjectile.setPosition((float) (owner.getEntity().getPosition().x + 0.75),
(float) (owner.getEntity().getPosition().y + 0.75));
newProjectile.setPosition((float) (owner.getEntity().getPosition().x + 0.25),
(float) (owner.getEntity().getPosition().y + 0.25));
ServiceLocator.getEntityService().register(newProjectile);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.csse3200.game.components.tasks.CurrencyTask;
import com.csse3200.game.entities.Entity;
import com.csse3200.game.physics.PhysicsLayer;
import com.csse3200.game.physics.PhysicsUtils;
import com.csse3200.game.physics.components.ColliderComponent;
import com.csse3200.game.physics.components.HitboxComponent;
import com.csse3200.game.physics.components.PhysicsComponent;
Expand Down Expand Up @@ -155,8 +156,7 @@ public static Entity createFireTower() {
.addComponent(aiTaskComponent)
.addComponent(animator)
.addComponent(new FireTowerAnimationController());

fireTower.setScale(3, 3);
fireTower.setScale(1.25f, 1.25f);
return fireTower;
}

Expand All @@ -182,6 +182,7 @@ public static Entity createStunTower() {
.addComponent(new StunTowerAnimationController());

stunTower.setScale(1.5f, 1.5f);
PhysicsUtils.setScaledCollider(stunTower, 0.5f, 0.5f);
return stunTower;
}

Expand Down

0 comments on commit 4441a3b

Please sign in to comment.