Skip to content

Commit

Permalink
commiting for push
Browse files Browse the repository at this point in the history
  • Loading branch information
gregchan550 committed Oct 10, 2023
1 parent 2b1c77b commit 3887a2c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
14 changes: 7 additions & 7 deletions source/core/src/main/com/csse3200/game/areas/ForestGameArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,18 @@ public void create() {
// Set up infrastructure for end game tracking
player = spawnPlayer();

// waves = WaveFactory.createWaves();
// spawnEntity(waves);
// waves.getEvents().addListener("spawnWave", this::spawnMob);
spawnGregMob(18, 2);
waves = WaveFactory.createWaves();
spawnEntity(waves);
waves.getEvents().addListener("spawnWave", this::spawnMob);
// spawnGregMob(18, 2);
// spawnDemonBoss();
spawnEffectProjectile(new Vector2(10f,2f), PhysicsLayer.NPC, 20, new Vector2(2f,2f), ProjectileEffects.SLOW, false);
// spawnEffectProjectile(new Vector2(10f,2f), PhysicsLayer.NPC, 20, new Vector2(2f,2f), ProjectileEffects.SLOW, false);

spawnScrap();
spawnGapScanners();

// spawnTNTTower();
spawnWeaponTower(new GridPoint2(2, 2));
// spawnWeaponTower(new GridPoint2(2, 2));
// spawnGapScanners();
// spawnDroidTower();
// spawnFireWorksTower(); // Commented these out until they are needed for Demonstration
Expand Down Expand Up @@ -829,7 +829,7 @@ private void spawnWeaponTower(GridPoint2 pos) {
// spawnEntityAt(stunTower, randomPos2, true, true);
// spawnEntityAt(wallTower, randomPos2, true, true);
// }
Entity fireTower = TowerFactory.createStunTower();
Entity fireTower = TowerFactory.createDroidTower();
spawnEntityAt(fireTower, pos, true, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class EffectComponent extends Component {
private long slowTime;
private long stunTime;
private Vector2 defaultTargetSpeed;
private PhysicsMovementComponent targetPhysics;
private static final Vector2 STUN_SPEED = new Vector2(0f,0f);
private static final long BURN_TICK = 1000;

Expand Down Expand Up @@ -65,10 +66,10 @@ public void update() {
if (slowFlag) {
isSlowed = true;
Vector2 half_speed = new Vector2(defaultTargetSpeed.x / 2, defaultTargetSpeed.y / 2);
target.getComponent(PhysicsMovementComponent.class).setSpeed(half_speed);
targetPhysics.setSpeed(half_speed);
} else if (isSlowed) {
isSlowed = false;
target.getComponent(PhysicsMovementComponent.class).setSpeed(defaultTargetSpeed);
targetPhysics.setSpeed(defaultTargetSpeed);
}
} else {
if (slowFlag && !isSlowed) {
Expand All @@ -88,13 +89,13 @@ public void update() {
if (defaultTargetSpeed == null) {
return;
}
target.getComponent(PhysicsMovementComponent.class).setSpeed(STUN_SPEED);
targetPhysics.setSpeed(STUN_SPEED);
} else if (isStunned) {
if (target == null) {
return;
}
isStunned = false;
target.getComponent(PhysicsMovementComponent.class).setSpeed(defaultTargetSpeed);
targetPhysics.setSpeed(defaultTargetSpeed);
}
} else {
if (stunFlag && !isStunned) {
Expand All @@ -107,7 +108,12 @@ public void update() {
public void applyEffect(ProjectileEffects effect, Entity host, Entity target) {
this.host = host;
this.target = target;
defaultTargetSpeed = entity.getComponent(PhysicsMovementComponent.class).getNormalSpeed();

targetPhysics = entity.getComponent(PhysicsMovementComponent.class);
if (targetPhysics == null) {
return;
}
defaultTargetSpeed = targetPhysics.getNormalSpeed();
if (defaultTargetSpeed == null) {
defaultTargetSpeed = new Vector2(1f,1f);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public void start() {
*/
@Override
public void update() {
// System.out.println(mob.getComponent(PhysicsMovementComponent.class).getSpeed());
// death check
if (mob.getComponent(CombatStatsComponent.class).getHealth() <= 0 && !deathFlag) {
changeState(State.DEATH);
Expand Down

0 comments on commit 3887a2c

Please sign in to comment.