Skip to content

Commit

Permalink
Fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ThivanW committed Oct 2, 2023
2 parents 2a40dd9 + 251742d commit 4005c46
Show file tree
Hide file tree
Showing 101 changed files with 10,019 additions and 1,169 deletions.
768 changes: 768 additions & 0 deletions hs_err_pid14780.log

Large diffs are not rendered by default.

786 changes: 786 additions & 0 deletions hs_err_pid19432.log

Large diffs are not rendered by default.

929 changes: 929 additions & 0 deletions hs_err_pid22188.log

Large diffs are not rendered by default.

765 changes: 765 additions & 0 deletions hs_err_pid22716.log

Large diffs are not rendered by default.

860 changes: 860 additions & 0 deletions hs_err_pid26164.log

Large diffs are not rendered by default.

840 changes: 840 additions & 0 deletions hs_err_pid28328.log

Large diffs are not rendered by default.

808 changes: 808 additions & 0 deletions hs_err_pid29160.log

Large diffs are not rendered by default.

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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/core/assets/images/grass_2.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 added source/core/assets/images/highlight_tile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
756 changes: 756 additions & 0 deletions source/core/assets/images/mobboss/iceBaby.atlas

Large diffs are not rendered by default.

Binary file added source/core/assets/images/mobboss/iceBaby.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 added source/core/assets/sounds/mobBoss/demonAttack.wav
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonCleave.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonDeath.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonHeal.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonJump.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonLand.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/demonSpawn.wav
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/iceBabyAOE.mp3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/patrickCast.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/patrickHit.mp3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/slimeJump.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/slimePop.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobBoss/slimeySplat.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobs/boneBreak.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobs/fireWormRoar.mp3
Binary file not shown.
Binary file added source/core/assets/sounds/mobs/fireWormRoar.wav
Binary file not shown.
Binary file not shown.
Binary file added source/core/assets/sounds/mobs/wizardSpell.mp3
Binary file not shown.
379 changes: 233 additions & 146 deletions source/core/src/main/com/csse3200/game/areas/ForestGameArea.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
package com.csse3200.game.areas.terrain;

import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TiledMapRenderer;
import com.badlogic.gdx.maps.tiled.TiledMapTile;
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Timer;
import com.csse3200.game.rendering.RenderComponent;
import com.csse3200.game.services.ResourceService;
import com.csse3200.game.services.ServiceLocator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Render a tiled terrain for a given tiled map and orientation. A terrain is a map of tiles that
* shows the 'ground' in the game. Enabling/disabling this component will show/hide the terrain.
*/
public class TerrainComponent extends RenderComponent {
private static final Logger logger = LoggerFactory.getLogger(TerrainComponent.class);
private static final int TERRAIN_LAYER = 0;

private final TiledMap tiledMap;
private final TiledMapRenderer tiledMapRenderer;
private final OrthographicCamera camera;
private final TerrainOrientation orientation;
private final float tileSize;
private TiledMapTileLayer.Cell lastHoveredCell = null;
private TiledMapTile originalTile = null;
private TextureRegion originalRegion = null;



public TerrainComponent(
OrthographicCamera camera,
Expand All @@ -33,6 +48,7 @@ public TerrainComponent(
this.orientation = orientation;
this.tileSize = tileSize;
this.tiledMapRenderer = renderer;

}

public Vector2 tileToWorldPosition(GridPoint2 tilePos) {
Expand Down Expand Up @@ -70,6 +86,7 @@ public TiledMap getMap() {
@Override
public void draw(SpriteBatch batch) {
tiledMapRenderer.setView(camera);
hoverHighlight();
tiledMapRenderer.render();
}

Expand All @@ -89,6 +106,86 @@ public int getLayer() {
return TERRAIN_LAYER;
}

// TODO : This is just a visual effect that we might not need in the end but just keeping it here for now
public void colorTile(final int x, final int y) {
final TiledMapTileLayer tileLayer = (TiledMapTileLayer) tiledMap.getLayers().get(0);
final TiledMapTile originalTile = tileLayer.getCell(x, y).getTile();

ResourceService resourceService = ServiceLocator.getResourceService();

// Load all the tiles into an array
final TerrainTile[] terrainTiles = new TerrainTile[7];
for (int i = 0; i < 7; i++) {
Texture texture = resourceService.getAsset("images/GrassTile/grass_tile_" + (i + 1) + ".png", Texture.class);
terrainTiles[i] = new TerrainTile(new TextureRegion(texture));
}

final float interval = 0.2f; // Switch every 0.2 seconds
final float duration = 1.4f; // 7 images * 0.2 seconds each

Timer.schedule(new Timer.Task() {
float timeElapsed = 0.0f;

@Override
public void run() {
timeElapsed += interval;

if (timeElapsed >= duration) {
tileLayer.getCell(x, y).setTile(originalTile); // Reset to original tile after the total duration
this.cancel(); // End the timer task
} else {
int index = (int) (timeElapsed / interval);
tileLayer.getCell(x, y).setTile(terrainTiles[index]);
}
}
}, 0, interval, (int) (duration / interval) - 1); // Scheduling the task
}

/**
* Highlights the tile under the mouse cursor by changing its texture region.
*
* When hovering over a tile on the terrain, this method performs the following:
*
* 1-Unprojects the mouse's screen position to the world position using the camera.
* 2-Calculates the tile's coordinates based on the world position and tile size.
* 3-If there was a previously highlighted tile, it restores its original texture region.
* 4-If the current tile under the mouse is different from the last hovered tile, it updates.
* 5-the tile's texture region to a highlight texture.
* 6-Updates the reference to the last hovered tile.
*
* @see TiledMapTileLayer
* @see TiledMapTileLayer.Cell
* @see TextureRegion
*/

public void hoverHighlight() {
Vector3 mousePos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
camera.unproject(mousePos);


int tileX = (int) (mousePos.x / tileSize);
int tileY = (int) (mousePos.y / tileSize);

final TiledMapTileLayer tileLayer = (TiledMapTileLayer) tiledMap.getLayers().get(0);
TiledMapTileLayer.Cell currentCell = tileLayer.getCell(tileX, tileY);


if (lastHoveredCell != null && lastHoveredCell != currentCell && originalRegion != null) {
lastHoveredCell.getTile().setTextureRegion(originalRegion);
}


if (currentCell != null && currentCell != lastHoveredCell) {
originalRegion = currentCell.getTile().getTextureRegion();

ResourceService resourceService = ServiceLocator.getResourceService();
Texture texture = resourceService.getAsset("images/highlight_tile.png", Texture.class);
currentCell.getTile().setTextureRegion(new TextureRegion(texture));
}

lastHoveredCell = currentCell;
}

public enum TerrainOrientation {
ORTHOGONAL,
ISOMETRIC,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.csse3200.game.areas.terrain;

import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.maps.tiled.TiledMap;
import com.badlogic.gdx.maps.tiled.TiledMapRenderer;
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile;
import com.badlogic.gdx.math.GridPoint2;
import com.csse3200.game.components.CameraComponent;
import com.csse3200.game.services.ResourceService;
Expand Down Expand Up @@ -81,7 +83,7 @@ private TerrainComponent createTerrain(float tileWorldSize, TextureRegion terrai
* @return A TiledMapRenderer instance suitable for the given map and scale.
*/

private TiledMapRenderer createRenderer(TiledMap tiledMap, float tileScale) {
public TiledMapRenderer createRenderer(TiledMap tiledMap, float tileScale) {
switch (orientation) {
case ORTHOGONAL:
return new OrthogonalTiledMapRenderer(tiledMap, tileScale);
Expand All @@ -100,9 +102,8 @@ private TiledMapRenderer createRenderer(TiledMap tiledMap, float tileScale) {
private TiledMap createTiles(GridPoint2 tileSize, TextureRegion terrain) {
TiledMap tiledMap = new TiledMap();

TerrainTile Tile = new TerrainTile(terrain);
TiledMapTileLayer Layer = new TiledMapTileLayer(20, 8, tileSize.x, tileSize.y);
fillInvisibleTiles(Layer, new GridPoint2(20, 8), Tile);
TiledMapTileLayer Layer = new TiledMapTileLayer(20, 6, tileSize.x, tileSize.y);
fillInvisibleTiles(Layer, new GridPoint2(20, 6), terrain);
tiledMap.getLayers().add(Layer);

return tiledMap;
Expand All @@ -114,11 +115,12 @@ private TiledMap createTiles(GridPoint2 tileSize, TextureRegion terrain) {
*
* @param layer The tile layer to fill.
* @param mapSize The size of the map in tiles.
* @param tile The tile used to fill the layer.
* @param terrain The tile used to fill the layer.
*/
private void fillInvisibleTiles(TiledMapTileLayer layer, GridPoint2 mapSize, TerrainTile tile) {
private void fillInvisibleTiles(TiledMapTileLayer layer, GridPoint2 mapSize, TextureRegion terrain) {
for (int x = 0; x < mapSize.x; x++) {
for (int y = 2; y < mapSize.y; y++) {
for (int y = 0; y < mapSize.y; y++) {
TerrainTile tile = new TerrainTile(terrain);
Cell cell = new Cell();
cell.setTile(tile);
layer.setCell(x, y, cell);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import com.csse3200.game.entities.configs.ProjectileConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Currency;
import java.util.Random;

/**
* Component used to store information related to combat such as health, attack, etc. Any entities
Expand Down Expand Up @@ -39,7 +39,7 @@ public class CombatStatsComponent extends Component {
private ArrayList<Currency> drops;
private ArrayList<Melee> closeRangeAbilities;
private ArrayList<ProjectileConfig> longRangeAbilities; //TODO change String to Projectiles
private Random rand = new Random();
private SecureRandom rand = new SecureRandom();

public CombatStatsComponent(int health, int baseAttack) {
setHealth(health);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private void onCollisionEnd(Fixture me, Fixture other) {
// * RIGHT NOW TARGET IS NPC, SUBJECT TO CHANGE
// Speed is a bit faster than normal but can change.
Entity newProjectile = ProjectileFactory.createFireworks(PhysicsLayer.NPC,
new Vector2(100, (float) (projectile.getPosition().y + (newDirection - (TOTAL_RANGE/2)))), new Vector2(3f, 3f));
new Vector2(100, (float) (projectile.getPosition().y + (newDirection - (double) (TOTAL_RANGE/2)))), new Vector2(3f, 3f));

newProjectile.setPosition(newXPosition, (float) projectile.getPosition().y);

Expand Down
Loading

0 comments on commit 4005c46

Please sign in to comment.