Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Team 2 engineers - Final sprint 2 merge #154

Merged
merged 8 commits into from
Sep 12, 2023
47 changes: 8 additions & 39 deletions source/core/src/main/com/csse3200/game/areas/ForestGameArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ public void create() {
loadAssets();
displayUI();
spawnTerrain();
// spawnBuilding1();
// spawnBuilding2();
// spawnMountains();

// Set up infrastructure for end game tracking
player = spawnPlayer();
Expand All @@ -192,17 +189,14 @@ 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);
// spawnProjectileTest(new Vector2(0, 8), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f));
spawnXenoGrunts();
// spawnGhosts();
spawnWeaponTower();
// spawnIncome();
spawnScrap();
spawnTNTTower();

spawnGapScanners();
spawnDroidTower();
// spawnGapScanners();
// bossKing1 = spawnBossKing1();
// bossKing2 = spawnBossKing2();

bossKing2 = spawnBossKing2();
}
Expand Down Expand Up @@ -656,37 +650,12 @@ private void spawnEngineer() {
* Creates the scanners (one per lane) that detect absence of towers and presence of mobs,
* and trigger engineer spawning
*/
// private void spawnGapScanners() {
// for (int i = 0; i < terrain.getMapBounds(0).y; i++) {
// Entity scanner = GapScannerFactory.createScanner();
// spawnEntityAt(scanner, new GridPoint2(0, i), true, true);
// }
// }
// GridPoint2 minPos = new GridPoint2(0, 0);
// GridPoint2 maxPos = new GridPoint2(5, terrain.getMapBounds(0).sub(2, 2).y);
// GridPoint2 randomPos = RandomUtils.random(minPos, maxPos);
//
// Entity engineer = EngineerFactory.createEngineer();
// spawnEntityAt(engineer, randomPos, true, true);
// }

private void spawnGapScanners() {
for (int i = 0; i < terrain.getMapBounds(0).y; i++) {
Entity scanner = GapScannerFactory.createScanner();
spawnEntityAt(scanner, new GridPoint2(0, i), true, true);
}
}

// private void gameTrackerStart() {
// Entity endGameTracker = new Entity();
//
// endGameTracker
// .addComponent(new CombatStatsComponent(2, 0))
// .addComponent(new PlayerStatsDisplay());
//// .getEvents().addListener("engineerKilled" , this::decrementCounter);
// endGameTracker.create();
// }

// private void decrementCounter() {
// this.endStateCounter -= 1;
// logger.info("Engineer killed");
// if (endStateCounter <= 0) {
// // we've reached the end, game over
// this.dispose();
// }
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class HumanWanderTask extends DefaultTask implements PriorityTask {
private Task currentTask;
private boolean isDead = false;

private boolean hasDied = false;

/**
* Constructor of HumanWanderTask
*
Expand All @@ -53,7 +55,6 @@ public int getPriority() {

/**
* Starts the HumanWanderTask instance and instantiates subtasks (HumanWaitTask, HumanWanderTask, EngineerCombatTask).
*
*/
@Override
public void start() {
Expand Down Expand Up @@ -85,6 +86,11 @@ public void start() {
*/
@Override
public void update() {
hasDied = owner.getEntity().getComponent(CombatStatsComponent.class).isDead();
// Check if engineer has died since last update
if (!isDead && hasDied) {
startDying();
}

boolean justDied = owner.getEntity().getComponent(CombatStatsComponent.class).isDead();
// Check if engineer has died since last update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ public GameEndService() {
* @param newLimit as an integer representing the maximum number of engineer deaths
*/
public void setEngineerCount(int newLimit) {
if (newLimit > 0) {
if (newLimit > 0 && newLimit < 1000) {
engineerCount = newLimit;
display.updateCount();
}
}

Expand Down