Skip to content

Commit

Permalink
Merge pull request #106 from UQcsse3200/Team-4---General-Mobs
Browse files Browse the repository at this point in the history
Team 4   general mobs
  • Loading branch information
Mohamad11Dab authored Sep 7, 2023
2 parents 2b4130f + 6d3376d commit d041b68
Show file tree
Hide file tree
Showing 17 changed files with 773 additions and 114 deletions.
Binary file added source/core/assets/images/xeno-Grunt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
292 changes: 292 additions & 0 deletions source/core/assets/images/xenoGrunt.atlas
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
xeno-Grunt.png
size: 1800, 1200
format: RGBA8888
filter: Nearest,Nearest
repeat: none
xeno_run
rotate: false
xy: 0, 0
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 0
xeno_run
rotate: false
xy: 200, 0
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 1
xeno_run
rotate: false
xy: 400, 0
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 2
xeno_run
rotate: false
xy: 600, 0
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 3
xeno_run
rotate: false
xy: 800, 0
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 4
xeno_run
rotate: false
xy: 1000, 0
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 5
xeno_run
rotate: false
xy: 1200, 0
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 6
xeno_run
rotate: false
xy: 1400, 0
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 7
xeno_hurt
rotate: false
xy: 0, 200
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 0
xeno_hurt
rotate: false
xy: 200, 200
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 1
xeno_hurt
rotate: false
xy: 400, 200
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 2
xeno_hurt
rotate: false
xy: 600, 200
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 3
xeno_hurt
rotate: false
xy: 800, 200
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 4
xeno_hurt
rotate: false
xy: 1000, 200
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 5
xeno_hurt
rotate: false
xy: 1200, 200
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 6
xeno_hurt
rotate: false
xy: 1400, 200
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 7
xeno_melee_1
rotate: false
xy: 0, 400
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 0
xeno_melee_1
rotate: false
xy: 200, 400
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 1
xeno_melee_1
rotate: false
xy: 400, 400
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 2
xeno_melee_1
rotate: false
xy: 600, 400
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 3
xeno_melee_1
rotate: false
xy: 800, 400
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 4
xeno_melee_1
rotate: false
xy: 1000, 400
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 5
xeno_melee_1
rotate: false
xy: 1200, 400
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 6
xeno_melee_1
rotate: false
xy: 1400, 400
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 7
xeno_melee_1
rotate: false
xy: 1600, 400
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 8
xeno_melee_2
rotate: false
xy: 0, 600
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 0
xeno_melee_2
rotate: false
xy: 200, 600
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 1
xeno_melee_2
rotate: false
xy: 400, 600
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 2
xeno_melee_2
rotate: false
xy: 600, 600
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 3
xeno_melee_2
rotate: false
xy: 800, 600
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 4
xeno_melee_2
rotate: false
xy: 1000, 600
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 5
xeno_melee_2
rotate: false
xy: 1200, 600
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 6
xeno_shoot
rotate: false
xy: 0, 800
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 0
xeno_shoot
rotate: false
xy: 200, 800
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 1
xeno_shoot
rotate: false
xy: 400, 800
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 2
xeno_shoot
rotate: false
xy: 600, 800
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 3
xeno_shoot
rotate: false
xy: 800, 800
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 4
xeno_shoot
rotate: false
xy: 1000, 800
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 5
xeno_die
rotate: false
xy: 0, 1000
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 0
xeno_die
rotate: false
xy: 200, 1000
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 1
default
rotate: false
xy: 0, 0
size: 200, 200
orig: 200, 200
offset: 0, 0
index: 0
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class ForestGameArea extends GameArea {
"images/ghostKing.atlas",
"images/towers/turret.atlas",
"images/towers/turret01.atlas",
"images/mobs/xenoGruntRunning.atlas",
"images/xenoGrunt.atlas",
"images/mobs/robot.atlas",
"images/mobs/rangeBossRight.atlas"
};
Expand Down Expand Up @@ -138,6 +138,7 @@ public void create() {
spawnBuilding2();
spawnMountains();
player = spawnPlayer();
player.getEvents().addListener("spawnWave", this::spawnXenoGrunts);

playMusic();

Expand Down Expand Up @@ -311,13 +312,15 @@ private void spawnProjectile(Vector2 position, Entity target, int space, int di

// }


private void spawnXenoGrunts() {
GridPoint2 minPos = terrain.getMapBounds(0).sub(1, 5);
GridPoint2 maxPos = terrain.getMapBounds(0).sub(1, 25);
for (int i = 0; i < NUM_GRUNTS; i++) {
GridPoint2 randomPos = RandomUtils.random(maxPos, minPos);
System.out.println(randomPos);
Entity xenoGrunt = NPCFactory.createXenoGrunt(player);
xenoGrunt.setScale(1.5f, 1.5f);
spawnEntityAt(xenoGrunt, randomPos, true, true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import com.csse3200.game.entities.Entity;
import com.csse3200.game.entities.Melee;
import com.csse3200.game.entities.Weapon;
import com.csse3200.game.entities.configs.ProjectileConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


import java.util.ArrayList;
import java.util.Currency;
import java.util.Random;

/**
Expand All @@ -30,9 +33,9 @@ public class CombatStatsComponent extends Component {
private int baseAttack;
private final int fullHealth;
private String state;
private ArrayList<Integer> drops;
private ArrayList<Currency> drops;
private ArrayList<Melee> closeRangeAbilities;
private ArrayList<Weapon> longRangeAbilities; //TODO change String to Projectiles
private ArrayList<ProjectileConfig> longRangeAbilities; //TODO change String to Projectiles

public CombatStatsComponent(int health, int baseAttack) {
setHealth(health);
Expand All @@ -42,9 +45,9 @@ public CombatStatsComponent(int health, int baseAttack) {
}

public CombatStatsComponent(int health, int baseAttack,
ArrayList<Integer> drops,
ArrayList<Currency> drops,
ArrayList<Melee> closeRangeAbilities,
ArrayList<Weapon> longRangeAbilities) {
ArrayList<ProjectileConfig> longRangeAbilities) {
setHealth(health);
this.fullHealth = health;
setBaseAttack(baseAttack);
Expand Down Expand Up @@ -134,6 +137,7 @@ public void hit(Integer damage) {
public void hit(CombatStatsComponent attacker) {
int newHealth = getHealth() - attacker.getBaseAttack();
setHealth(newHealth);
changeState();
}

/**
Expand All @@ -145,15 +149,15 @@ public int pickRandom(ArrayList pickFrom) {
}

//TODO: this will be changed to drop an item and load it to the screen
public Integer drop() {
public Currency drop() {
return this.drops.get(pickRandom(this.drops));
}

/**
* If there are long range attacks provided, return a random one, else
* return null
* */
public Weapon longRangeAttack() {
public ProjectileConfig longRangeAttack() {
if (this.longRangeAbilities == null) {
return null;
}
Expand Down
Loading

0 comments on commit d041b68

Please sign in to comment.