From 8bd04ed1400f310a007e391e42a227729ae507fa Mon Sep 17 00:00:00 2001 From: Jeasonfire Date: Mon, 18 May 2015 02:55:02 +0300 Subject: [PATCH] Added round 5 to list & implemented gore levels. --- .../gladiator/listeners/BasicDeathListener.java | 17 ++++++++++------- .../saltosion/gladiator/state/InGameState.java | 3 ++- .../com/saltosion/gladiator/util/Global.java | 5 +++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/core/src/com/saltosion/gladiator/listeners/BasicDeathListener.java b/core/src/com/saltosion/gladiator/listeners/BasicDeathListener.java index 320fb79..07d1126 100644 --- a/core/src/com/saltosion/gladiator/listeners/BasicDeathListener.java +++ b/core/src/com/saltosion/gladiator/listeners/BasicDeathListener.java @@ -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; + } + } diff --git a/core/src/com/saltosion/gladiator/state/InGameState.java b/core/src/com/saltosion/gladiator/state/InGameState.java index 17983a6..3d5c3c6 100644 --- a/core/src/com/saltosion/gladiator/state/InGameState.java +++ b/core/src/com/saltosion/gladiator/state/InGameState.java @@ -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; diff --git a/core/src/com/saltosion/gladiator/util/Global.java b/core/src/com/saltosion/gladiator/util/Global.java index be3e53e..5b3e1e7 100644 --- a/core/src/com/saltosion/gladiator/util/Global.java +++ b/core/src/com/saltosion/gladiator/util/Global.java @@ -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 */