Skip to content

Commit

Permalink
mobs stopping when shooting again and fixed spawning coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
samsully committed Sep 10, 2023
1 parent d1a2a98 commit b4ebcc1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ private void spawnProjectile(Vector2 position, short targetLayer, int space, in


private void spawnXenoGrunts() {
GridPoint2 minPos = terrain.getMapBounds(0).sub(1, 5);
GridPoint2 maxPos = terrain.getMapBounds(0).sub(1, 25);
GridPoint2 minPos = terrain.getMapBounds(0).sub(1, 0);
GridPoint2 maxPos = terrain.getMapBounds(0).sub(1, 10);
for (int i = 0; i < NUM_GRUNTS; i++) {
GridPoint2 randomPos = RandomUtils.random(maxPos, minPos);
System.out.println(randomPos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,19 @@ public void updateMobState() {
case IDLE -> {
if (isTargetVisible()) {
// targets detected in idle mode - start deployment
//owner.getEntity().getEvents().trigger(DEPLOY);
owner.getEntity().getEvents().trigger(DEPLOY);
mobState = STATE.DEPLOY;
}
}

case DEPLOY -> {
// currently deploying,
if (isTargetVisible()) {
//owner.getEntity().getEvents().trigger(FIRING);
if (isTargetVisible() || this.meleeOrProjectile() != null) {
owner.getEntity().getComponent(PhysicsMovementComponent.class).setEnabled(false);
owner.getEntity().getEvents().trigger(FIRING);
mobState = STATE.FIRING;
} else {
//owner.getEntity().getEvents().trigger(STOW);
owner.getEntity().getEvents().trigger(STOW);
mobState = STATE.STOW;
}
}
Expand All @@ -139,10 +140,10 @@ public void updateMobState() {
case STOW -> {
// currently stowing
if (isTargetVisible()) {
//owner.getEntity().getEvents().trigger(DEPLOY);
owner.getEntity().getEvents().trigger(DEPLOY);
mobState = STATE.DEPLOY;
} else {
//owner.getEntity().getEvents().trigger(IDLE);
owner.getEntity().getEvents().trigger(IDLE);
mobState = STATE.IDLE;
}
}
Expand All @@ -168,7 +169,6 @@ public void stop() {
*/
@Override
public int getPriority() {
// return -1;
if (status == Status.ACTIVE) {
return getActivePriority();
}
Expand Down Expand Up @@ -223,8 +223,6 @@ private Weapon meleeOrProjectile() {
Weapon chosenWeapon = null;
if (comp != null) {
chosenWeapon = comp.chooseWeapon(hitraycast);
if (chosenWeapon != null) {
}
}

return chosenWeapon;
Expand Down

0 comments on commit b4ebcc1

Please sign in to comment.