diff --git a/core/src/com/saltosion/gladiator/level/premade/Round1Level.java b/core/src/com/saltosion/gladiator/level/premade/Round1Level.java index 2acc512..be57552 100644 --- a/core/src/com/saltosion/gladiator/level/premade/Round1Level.java +++ b/core/src/com/saltosion/gladiator/level/premade/Round1Level.java @@ -43,7 +43,7 @@ public class Round1Level implements Level { enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT, new CAI().setReactDistance(12f).setAIListener(new HeavenWorshiperAI()))); enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-10, 2), Direction.RIGHT, - new CAI().setReactDistance(12f).setAIListener(new BerserkerAI()))); + new CAI().setReactDistance(12f).setAIListener(new HeavenWorshiperAI()))); } } diff --git a/core/src/com/saltosion/gladiator/level/premade/Round3Level.java b/core/src/com/saltosion/gladiator/level/premade/Round3Level.java index a5c184e..7d65ca7 100644 --- a/core/src/com/saltosion/gladiator/level/premade/Round3Level.java +++ b/core/src/com/saltosion/gladiator/level/premade/Round3Level.java @@ -17,7 +17,7 @@ public class Round3Level implements Level { @Override public String getLevelName() { - return "Round 1"; + return "Round 3"; } @Override diff --git a/core/src/com/saltosion/gladiator/level/premade/Round4Level.java b/core/src/com/saltosion/gladiator/level/premade/Round4Level.java index 409be2b..305b02f 100644 --- a/core/src/com/saltosion/gladiator/level/premade/Round4Level.java +++ b/core/src/com/saltosion/gladiator/level/premade/Round4Level.java @@ -17,7 +17,7 @@ public class Round4Level implements Level { @Override public String getLevelName() { - return "Round 1"; + return "Round 4"; } @Override @@ -40,9 +40,9 @@ public class Round4Level implements Level { AppUtil.levelFactory.createLevelBase(); player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT); enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT, - new CAI().setReactDistance(12f).setAIListener(new HunterAI()))); + new CAI().setReactDistance(8f).setAIListener(new HunterAI()))); enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-10, 2), Direction.RIGHT, - new CAI().setReactDistance(12f).setAIListener(new HunterAI()))); + new CAI().setReactDistance(8f).setAIListener(new HunterAI()))); } } diff --git a/core/src/com/saltosion/gladiator/level/premade/Round5Level.java b/core/src/com/saltosion/gladiator/level/premade/Round5Level.java new file mode 100644 index 0000000..b2804c4 --- /dev/null +++ b/core/src/com/saltosion/gladiator/level/premade/Round5Level.java @@ -0,0 +1,48 @@ +package com.saltosion.gladiator.level.premade; + +import com.badlogic.ashley.core.Entity; +import com.badlogic.gdx.math.Vector2; +import com.saltosion.gladiator.components.CAI; +import com.saltosion.gladiator.level.Level; +import com.saltosion.gladiator.listeners.ai.BerserkerAI; +import com.saltosion.gladiator.util.AppUtil; +import com.saltosion.gladiator.util.Direction; +import com.saltosion.gladiator.util.Global; +import java.util.ArrayList; + +public class Round5Level implements Level { + + public Entity player; + public ArrayList enemies = new ArrayList(); + + @Override + public String getLevelName() { + return "Round 5"; + } + + @Override + public boolean levelCleared() { + for (Entity enemy : enemies) { + if ((enemy.flags & Global.FLAG_ALIVE) == Global.FLAG_ALIVE) { + return false; + } + } + return true; + } + + @Override + public boolean levelFailed() { + return (player.flags & Global.FLAG_ALIVE) == 0; + } + + @Override + public void generate() { + AppUtil.levelFactory.createLevelBase(); + player = AppUtil.entityFactory.createPlayer(new Vector2(0, 2), Direction.RIGHT); + enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(10, 2), Direction.LEFT, + new CAI().setReactDistance(10f).setAIListener(new BerserkerAI()))); + enemies.add(AppUtil.entityFactory.createEnemy(new Vector2(-10, 2), Direction.RIGHT, + new CAI().setReactDistance(10f).setAIListener(new BerserkerAI()))); + } + +} diff --git a/core/src/com/saltosion/gladiator/state/InGameState.java b/core/src/com/saltosion/gladiator/state/InGameState.java index ba1716e..17983a6 100644 --- a/core/src/com/saltosion/gladiator/state/InGameState.java +++ b/core/src/com/saltosion/gladiator/state/InGameState.java @@ -36,8 +36,8 @@ public class InGameState extends BaseState { public void create() { // Play music AppUtil.jukebox.playMusic(AudioLoader.getMusic(Name.MUSIC_BATTLE)); - AppUtil.jukebox.setMusicVolume(AppUtil.musicVolume/2); - + AppUtil.jukebox.setMusicVolume(AppUtil.musicVolume / 2); + // Start from a clean slate AppUtil.engine.removeAllEntities(); AppUtil.guiManager.clearGUI(); @@ -48,7 +48,7 @@ public class InGameState extends BaseState { guiCreator = new InGameGUICreator(); guiCreator.create(); - + // Activate inputs AppUtil.inputHandler.setInputEnabled(Name.JUMP, true); AppUtil.inputHandler.setInputEnabled(Name.MOVE_LEFT, true); @@ -103,7 +103,7 @@ public class InGameState extends BaseState { @Override public void destroy() { - + // Deactivate inputs AppUtil.inputHandler.setInputEnabled(Name.JUMP, false); AppUtil.inputHandler.setInputEnabled(Name.MOVE_LEFT, false); @@ -112,7 +112,7 @@ public class InGameState extends BaseState { AppUtil.inputHandler.setInputEnabled(Name.SWING_LEFT, false); AppUtil.inputHandler.setInputEnabled(Name.SWING_RIGHT, false); AppUtil.inputHandler.setInputEnabled(Name.SWING_UP, false); - + // Clear all entities that are left as they are no longer needed AppUtil.engine.removeAllEntities(); // Clear GUI so there's nothing leftover for the next state