Skip to content

Commit

Permalink
resolved merge conflicts while merging main
Browse files Browse the repository at this point in the history
  • Loading branch information
shiv-0831 committed Sep 11, 2023
2 parents 34a05fa + bf874ed commit 555d19f
Show file tree
Hide file tree
Showing 53 changed files with 1,246 additions and 589 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed source/core/assets/images/economy/crystalUI.png
Binary file not shown.
Binary file added source/core/assets/images/economy/scrapBanner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed source/core/assets/images/economy/scrapsUI.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/core/assets/images/lose-screen/lose-bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions source/core/assets/images/projectiles/burn_effect.atlas
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ projectile
orig: 36, 31
offset: 0, 0
index: -1
projectileFinal
projectile
rotate: false
xy: 116, 2
size: 36, 31
orig: 36, 31
offset: 0, 0
index: -1
projectile
projectileFinal
rotate: false
xy: 191, 2
size: 31, 31
Expand Down
41 changes: 41 additions & 0 deletions source/core/assets/images/projectiles/firework_anim.atlas
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

firework_anim.png
size: 128, 32
format: RGBA8888
filter: Nearest, Nearest
repeat: none
projectile
rotate: false
xy: 23, 2
size: 19, 16
orig: 19, 16
offset: 0, 0
index: -1
projectile
rotate: false
xy: 65, 2
size: 19, 16
orig: 19, 16
offset: 0, 0
index: -1
projectile
rotate: false
xy: 44, 2
size: 19, 16
orig: 19, 16
offset: 0, 0
index: -1
projectile
rotate: false
xy: 2, 2
size: 19, 16
orig: 19, 16
offset: 0, 0
index: -1
default
rotate: false
xy: 23, 2
size: 19, 16
orig: 19, 16
offset: 0, 0
index: -1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions source/core/assets/images/projectiles/pierce_anim.atlas
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

pierce_anim.png
size: 256, 32
format: RGBA8888
filter: Nearest, Nearest
repeat: none
projectile
rotate: false
xy: 2, 2
size: 35, 26
orig: 35, 26
offset: 0, 0
index: -1
projectile
rotate: false
xy: 76, 2
size: 35, 26
orig: 35, 26
offset: 0, 0
index: -1
projectile
rotate: false
xy: 39, 2
size: 35, 26
orig: 35, 26
offset: 0, 0
index: -1
projectile
rotate: false
xy: 113, 2
size: 35, 26
orig: 35, 26
offset: 0, 0
index: -1
default
projectile
rotate: false
xy: 2, 2
size: 35, 26
orig: 35, 26
offset: 0, 0
index: -1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion source/core/src/main/com/csse3200/game/GdxGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.csse3200.game.components.CombatStatsComponent;
import com.csse3200.game.files.UserSettings;
import com.csse3200.game.screens.*;
import org.slf4j.Logger;
Expand Down Expand Up @@ -74,13 +75,15 @@ private Screen newScreen(ScreenType screenType) {
return new StoryScreen(this);
case LEVEL_SELECT:
return new LevelSelectScreen(this);
case LOSING_SCREEN:
return new LosingScreen(this);
default:
return null;
}
}

public enum ScreenType {
MAIN_MENU, MAIN_GAME, SETTINGS, STORY_SCREEN, LEVEL_SELECT
MAIN_MENU, MAIN_GAME, SETTINGS, STORY_SCREEN, LEVEL_SELECT, LOSING_SCREEN
}

/**
Expand Down
74 changes: 49 additions & 25 deletions source/core/src/main/com/csse3200/game/areas/ForestGameArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.csse3200.game.components.CombatStatsComponent;
import com.csse3200.game.components.ProjectileEffects;
import com.csse3200.game.areas.terrain.TerrainFactory;
import com.csse3200.game.areas.terrain.TerrainFactory.TerrainType;
Expand All @@ -13,7 +12,6 @@
import com.csse3200.game.entities.Entity;
import com.csse3200.game.entities.factories.*;
import com.csse3200.game.physics.PhysicsLayer;
import com.csse3200.game.utils.math.GridPoint2Utils;
import com.csse3200.game.utils.math.RandomUtils;
import com.csse3200.game.services.ResourceService;
import com.csse3200.game.services.ServiceLocator;
Expand All @@ -32,30 +30,19 @@
/** Forest area for the demo game with trees, a player, and some enemies. */
public class ForestGameArea extends GameArea {
private static final Logger logger = LoggerFactory.getLogger(ForestGameArea.class);

// Counts the number of humans left, if this reaches zero, game over.
private int endStateCounter = 2;
private static final int NUM_BUILDINGS = 4;

private static final int NUM_WALLS = 7;

private static final int NUM_TREES = 0;
private static final int NUM_GHOSTS = 0;
private static final int NUM_GRUNTS = 5;

private static final int NUM_BOSS = 4;


private Timer bossSpawnTimer;
private int bossSpawnInterval = 10000; // 1 minute in milliseconds

private static final int NUM_WEAPON_TOWERS = 3;
private static final GridPoint2 PLAYER_SPAWN = new GridPoint2(0, 0);
// Temporary spawn point for testing
private static final float WALL_WIDTH = 0.1f;

private static final GridPoint2 BOSS_SPAWN = new GridPoint2(5, 5);

// Required to load assets before using them
private static final String[] forestTextures = {
"images/ingamebg.png",
Expand Down Expand Up @@ -109,7 +96,10 @@ public class ForestGameArea extends GameArea {
"images/projectiles/mobKing_projectile.png",
"images/projectiles/snow_ball.png",
"images/projectiles/burn_effect.png",
"images/projectiles/stun_effect.png"
"images/projectiles/stun_effect.png",
"images/projectiles/firework_anim.png",
"images/projectiles/pierce_anim.png",
"images/projectiles/snow_ball.png"
};
private static final String[] forestTextureAtlases = {
"images/economy/econ-tower.atlas",
Expand All @@ -134,9 +124,11 @@ public class ForestGameArea extends GameArea {
"images/projectiles/engineer_projectile.atlas",
"images/projectiles/mobKing_projectile.atlas",
"images/projectiles/snow_ball.atlas",
"images/projectiles/pierce_anim.atlas",
"images/projectiles/burn_effect.atlas",
"images/projectiles/firework_anim.atlas",
"images/projectiles/mobProjectile.atlas",
"images/projectiles/stun_effect.atlas"

};
private static final String[] forestSounds = {
"sounds/Impact4.ogg",
Expand All @@ -158,8 +150,6 @@ public class ForestGameArea extends GameArea {
// Variables to be used with spawn projectile methods. This is the variable
// that should occupy the direction param.
private static final int towardsMobs = 100;
private static final int towardsTowers = 0;
private Entity bossKing1;
private Entity bossKing2;


Expand Down Expand Up @@ -201,7 +191,7 @@ public void create() {
spawnPierceFireBall(new Vector2(2, 3), PhysicsLayer.NPC, towardsMobs, new Vector2(2f, 2f));
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);
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();
Expand All @@ -214,11 +204,13 @@ public void create() {
// bossKing1 = spawnBossKing1();
// bossKing2 = spawnBossKing2();

bossKing2 = spawnBossKing2();
}

private void displayUI() {
Entity ui = new Entity();
ui.addComponent(new GameAreaDisplay("Box Forest"));
ui.addComponent(ServiceLocator.getGameEndService().getDisplay());
ui.addComponent(ServiceLocator.getCurrencyService().getDisplay());
spawnEntity(ui);
}
Expand All @@ -235,8 +227,6 @@ private void spawnTerrain() {

// Left
// ! THIS ONE DOESNT WORK. GRIDPOINTS2UTIL.ZERO is (0, 4), not (0, 0)
// spawnEntityAt(
// ObstacleFactory.createWall(WALL_WIDTH, worldBounds.y), GridPoint2Utils.ZERO, false, false);
spawnEntityAt(
ObstacleFactory.createWall(WALL_WIDTH, worldBounds.y), new GridPoint2(1, 0), false, false);
// Right
Expand Down Expand Up @@ -279,6 +269,7 @@ private void spawnTerrain() {
// }
// }


// private void spawnMountains() {
// ArrayList<GridPoint2> fixedPositions = new ArrayList<>(); //Generating ArrayList
//
Expand All @@ -298,6 +289,18 @@ private void spawnTerrain() {
// }
// }

private void spawnBuilding2() {
GridPoint2 minPos = new GridPoint2(0, 0);
GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2);

for (int i = 0; i < NUM_BUILDINGS; i++) {
GridPoint2 randomPos = RandomUtils.random(minPos, maxPos);
Entity building2 = ObstacleFactory.createBuilding2();
spawnEntityAt(building2, randomPos, true, false);
}
}


private Entity spawnPlayer() {
Entity newPlayer = PlayerFactory.createPlayer();
spawnEntityAt(newPlayer, PLAYER_SPAWN, true, true);
Expand Down Expand Up @@ -378,6 +381,7 @@ private void spawnProjectile(Vector2 position, short targetLayer, int space, int
spawnEntity(Projectile);
}


// private Entity spawnBossKing() {
// for (int i = 0; i < NUM_BOSS; i++) {
// int fixedX = terrain.getMapBounds(0).x - 1; // Rightmost x-coordinate
Expand Down Expand Up @@ -435,6 +439,23 @@ private void spawnXenoGrunts() {
// return bossKing2;
// }

private Entity spawnBossKing2() {
GridPoint2 minPos = new GridPoint2(0, 0);
GridPoint2 maxPos = terrain.getMapBounds(0).sub(2, 2);

for (int i = 0; i < NUM_BOSS; i++) {
int fixedX = terrain.getMapBounds(0).x - 1; // Rightmost x-coordinate
int randomY = MathUtils.random(0, maxPos.y);
GridPoint2 randomPos = new GridPoint2(fixedX, randomY);
bossKing2 = BossKingFactory.createBossKing2(player);
spawnEntityAt(bossKing2,
randomPos,
true,
false);
}
return bossKing2;
}

/**
* Creates multiple projectiles that travel simultaneous. They all have same
* the starting point but different destinations.
Expand Down Expand Up @@ -527,14 +548,11 @@ private void spawnWeaponTower() {
for (int i = 0; i < NUM_WEAPON_TOWERS; i++) {
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, randomPos1, true, true);
spawnEntityAt(stunTower, randomPos2, true, true);
//spawnEntityAt(wallTower, new GridPoint2(randomPos1.x + 3, randomPos1.y), true, true);
}
}

Expand Down Expand Up @@ -621,7 +639,12 @@ private void spawnEngineer() {
Entity engineer = EngineerFactory.createEngineer();
spawnEntityAt(engineer, new GridPoint2(1, i), true, true);
}
//
}

/**
* 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();
Expand All @@ -634,7 +657,8 @@ private void spawnEngineer() {
//
// Entity engineer = EngineerFactory.createEngineer();
// spawnEntityAt(engineer, randomPos, true, true);
}
// }


// private void gameTrackerStart() {
// Entity endGameTracker = new Entity();
Expand Down
Loading

0 comments on commit 555d19f

Please sign in to comment.