Added round 5 to list & implemented gore levels.

This commit is contained in:
Jeasonfire 2015-05-18 02:55:02 +03:00 committed by Allexit
parent 9a0ea282c9
commit 20fbb0e49f
15 changed files with 60 additions and 11 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -32,7 +32,7 @@ public class GladiatorBrawler extends ApplicationAdapter {
private InputHandler inputHandler;
private Jukebox jukebox;
private BaseState currentState;
public static BaseState currentState;
@Override
public void create() {

View File

@ -0,0 +1,25 @@
package com.saltosion.gladiator.input;
import com.saltosion.gladiator.GladiatorBrawler;
import com.saltosion.gladiator.state.IntroState;
import com.saltosion.gladiator.util.Log;
public class IRSkipIntros implements InputReceiver {
@Override
public boolean pressed() {
if (GladiatorBrawler.currentState instanceof IntroState) {
((IntroState) GladiatorBrawler.currentState).skipIntros();
} else {
Log.error("Tried to skip intros when introstate is not active!");
}
return true;
}
@Override
public boolean released() {
return true;
}
}

View File

@ -31,6 +31,7 @@ public class InputHandler implements InputProcessor {
addInput(Keys.UP, Name.SWING_UP, false);
addInput(Keys.DOWN, Name.SWING_DOWN, false);
addInput(Keys.F2, Name.DEBUG, false);
addInput(Keys.ESCAPE, Name.SKIP_INTRO, false);
}
private void addInput(int key, String action, boolean activated) {

View File

@ -18,6 +18,7 @@ public class InputReceivers {
inputreceivers.put(Name.SWING_UP, new IRSwing(Direction.UP));
inputreceivers.put(Name.SWING_DOWN, new IRSwing(Direction.DOWN));
inputreceivers.put(Name.DEBUG, new IRDebugToggle());
inputreceivers.put(Name.SKIP_INTRO, new IRSkipIntros());
}
public static InputReceiver getReceiver(String key) {

View File

@ -12,22 +12,21 @@ import com.saltosion.gladiator.util.Name;
public class BasicDeathListener implements CombatListener {
private static final float FX_FORCE = 16f, FX_GRAV = -40f;
private static final int FX_HIT_AMT = 4, FX_DEAD_AMT = 96;
@Override
public void died(Entity source, Entity target, int damageTaken) {
target.flags &= ~Global.FLAG_ALIVE;
CPhysics cp = target.getComponent(CPhysics.class);
Sound s = AppUtil.jukebox.returnRandomSound(AudioLoader.getSound(Name.SOUND_HIT01),
AudioLoader.getSound(Name.SOUND_HIT02),
AudioLoader.getSound(Name.SOUND_HIT03),
AudioLoader.getSound(Name.SOUND_HIT04),
AudioLoader.getSound(Name.SOUND_HIT05));
s.play(AppUtil.sfxVolume);
for (int i = 0; i < FX_DEAD_AMT; i++) {
for (int i = 0; i < getGoreAmount(damageTaken) * 2; i++) {
Entity fx = new Entity();
fx.add(new CParticle().setColor(1, 0, 0, 1).setDecayTime(2).setGravity(0, FX_GRAV)
.setVelocity((float) Math.cos(Math.toRadians(Math.random() * 360)) * FX_FORCE,
@ -42,15 +41,15 @@ public class BasicDeathListener implements CombatListener {
@Override
public void damageTaken(Entity source, Entity target, int damageTaken) {
CPhysics cp = target.getComponent(CPhysics.class);
Sound s = AppUtil.jukebox.returnRandomSound(AudioLoader.getSound(Name.SOUND_HIT01),
AudioLoader.getSound(Name.SOUND_HIT02),
AudioLoader.getSound(Name.SOUND_HIT03),
AudioLoader.getSound(Name.SOUND_HIT04),
AudioLoader.getSound(Name.SOUND_HIT05));
s.play(AppUtil.sfxVolume);
for (int i = 0; i < FX_HIT_AMT; i++) {
for (int i = 0; i < getGoreAmount(damageTaken); i++) {
Entity fx = new Entity();
fx.add(new CParticle().setColor(1, 0, 0, 1).setDecayTime(2).setGravity(0, FX_GRAV)
.setVelocity((float) Math.cos(Math.toRadians(Math.random() * 360)) * FX_FORCE,
@ -62,4 +61,8 @@ public class BasicDeathListener implements CombatListener {
}
}
public int getGoreAmount(int damage) {
return (damage - 89) / 8 * Global.GORE_LEVEL;
}
}

View File

@ -6,6 +6,7 @@ import com.saltosion.gladiator.level.premade.Round1Level;
import com.saltosion.gladiator.level.premade.Round2Level;
import com.saltosion.gladiator.level.premade.Round3Level;
import com.saltosion.gladiator.level.premade.Round4Level;
import com.saltosion.gladiator.level.premade.Round5Level;
import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.AudioLoader;
import com.saltosion.gladiator.util.Name;
@ -16,7 +17,7 @@ public class InGameState extends BaseState {
* Add new levels to this list
*/
private static final Level[] levels = {new Round1Level(), new Round2Level(),
new Round3Level(), new Round4Level()};
new Round3Level(), new Round4Level(), new Round5Level()};
private Level level;
private InGameGUICreator guiCreator;

View File

@ -2,13 +2,15 @@ package com.saltosion.gladiator.state;
import com.saltosion.gladiator.gui.creators.IntroGUICreator;
import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.Name;
import com.saltosion.gladiator.util.SpriteLoader;
public class IntroState extends BaseState {
private static final float SPLASH_DELAY = 2f;
private static final float SPLASH_DELAY = 4f;
private IntroGUICreator guiCreator;
private float currentTime;
private boolean forceskip = false;
@Override
public void create() {
@ -18,12 +20,15 @@ public class IntroState extends BaseState {
SpriteLoader.preload();
guiCreator = new IntroGUICreator();
guiCreator.create();
// Enable skipping intro for now
AppUtil.inputHandler.setInputEnabled(Name.SKIP_INTRO, true);
}
@Override
public void update(float deltaTime) {
currentTime += deltaTime;
if (currentTime > SPLASH_DELAY) {
if ((currentTime > SPLASH_DELAY) || forceskip) {
boolean finished = guiCreator.nextSplashScreen();
if (finished && SpriteLoader.loadedAllSprites) {
setState(new MainMenuState());
@ -41,9 +46,16 @@ public class IntroState extends BaseState {
float f = Math.max(0, Math.min(1, currentTime / SPLASH_DELAY));
return f < 0.5 ? f * 2 : 1 - ((f - 0.5f) * 2f);
}
public void skipIntros() {
forceskip = true;
}
@Override
public void destroy() {
// And disable it now !
AppUtil.inputHandler.setInputEnabled(Name.SKIP_INTRO, false);
// Clear GUI so there's nothing leftover for the next state
AppUtil.guiManager.clearGUI();
}

View File

@ -11,6 +11,11 @@ public class Global {
public static final int FLAG_ALIVE = 1;
public static final int HIGH_GORE = 5;
public static final int LOW_GORE = 1;
public static final int NO_GORE = 0;
public static final int GORE_LEVEL = HIGH_GORE;
/**
* Higher font scale = smaller text
*/

View File

@ -34,6 +34,7 @@ public class Name {
public static final String SWING_RIGHT = "SWING_RIGHT";
public static final String SWING_UP = "SWING_UP";
public static final String SWING_DOWN = "SWING_DOWN";
public static final String SKIP_INTRO = "SKIP_INTRO";
public static final String MUSIC_THEME = "MUSIC_THEME";
public static final String MUSIC_BATTLE = "MUSIC_BATTLE";