Added round 5 to list & implemented gore levels.
This commit is contained in:
parent
9a0ea282c9
commit
8bd04ed140
@ -12,22 +12,21 @@ import com.saltosion.gladiator.util.Name;
|
|||||||
public class BasicDeathListener implements CombatListener {
|
public class BasicDeathListener implements CombatListener {
|
||||||
|
|
||||||
private static final float FX_FORCE = 16f, FX_GRAV = -40f;
|
private static final float FX_FORCE = 16f, FX_GRAV = -40f;
|
||||||
private static final int FX_HIT_AMT = 4, FX_DEAD_AMT = 96;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void died(Entity source, Entity target, int damageTaken) {
|
public void died(Entity source, Entity target, int damageTaken) {
|
||||||
target.flags &= ~Global.FLAG_ALIVE;
|
target.flags &= ~Global.FLAG_ALIVE;
|
||||||
|
|
||||||
CPhysics cp = target.getComponent(CPhysics.class);
|
CPhysics cp = target.getComponent(CPhysics.class);
|
||||||
|
|
||||||
Sound s = AppUtil.jukebox.returnRandomSound(AudioLoader.getSound(Name.SOUND_HIT01),
|
Sound s = AppUtil.jukebox.returnRandomSound(AudioLoader.getSound(Name.SOUND_HIT01),
|
||||||
AudioLoader.getSound(Name.SOUND_HIT02),
|
AudioLoader.getSound(Name.SOUND_HIT02),
|
||||||
AudioLoader.getSound(Name.SOUND_HIT03),
|
AudioLoader.getSound(Name.SOUND_HIT03),
|
||||||
AudioLoader.getSound(Name.SOUND_HIT04),
|
AudioLoader.getSound(Name.SOUND_HIT04),
|
||||||
AudioLoader.getSound(Name.SOUND_HIT05));
|
AudioLoader.getSound(Name.SOUND_HIT05));
|
||||||
s.play(AppUtil.sfxVolume);
|
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();
|
Entity fx = new Entity();
|
||||||
fx.add(new CParticle().setColor(1, 0, 0, 1).setDecayTime(2).setGravity(0, FX_GRAV)
|
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,
|
.setVelocity((float) Math.cos(Math.toRadians(Math.random() * 360)) * FX_FORCE,
|
||||||
@ -42,15 +41,15 @@ public class BasicDeathListener implements CombatListener {
|
|||||||
@Override
|
@Override
|
||||||
public void damageTaken(Entity source, Entity target, int damageTaken) {
|
public void damageTaken(Entity source, Entity target, int damageTaken) {
|
||||||
CPhysics cp = target.getComponent(CPhysics.class);
|
CPhysics cp = target.getComponent(CPhysics.class);
|
||||||
|
|
||||||
Sound s = AppUtil.jukebox.returnRandomSound(AudioLoader.getSound(Name.SOUND_HIT01),
|
Sound s = AppUtil.jukebox.returnRandomSound(AudioLoader.getSound(Name.SOUND_HIT01),
|
||||||
AudioLoader.getSound(Name.SOUND_HIT02),
|
AudioLoader.getSound(Name.SOUND_HIT02),
|
||||||
AudioLoader.getSound(Name.SOUND_HIT03),
|
AudioLoader.getSound(Name.SOUND_HIT03),
|
||||||
AudioLoader.getSound(Name.SOUND_HIT04),
|
AudioLoader.getSound(Name.SOUND_HIT04),
|
||||||
AudioLoader.getSound(Name.SOUND_HIT05));
|
AudioLoader.getSound(Name.SOUND_HIT05));
|
||||||
s.play(AppUtil.sfxVolume);
|
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();
|
Entity fx = new Entity();
|
||||||
fx.add(new CParticle().setColor(1, 0, 0, 1).setDecayTime(2).setGravity(0, FX_GRAV)
|
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,
|
.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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import com.saltosion.gladiator.level.premade.Round1Level;
|
|||||||
import com.saltosion.gladiator.level.premade.Round2Level;
|
import com.saltosion.gladiator.level.premade.Round2Level;
|
||||||
import com.saltosion.gladiator.level.premade.Round3Level;
|
import com.saltosion.gladiator.level.premade.Round3Level;
|
||||||
import com.saltosion.gladiator.level.premade.Round4Level;
|
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.AppUtil;
|
||||||
import com.saltosion.gladiator.util.AudioLoader;
|
import com.saltosion.gladiator.util.AudioLoader;
|
||||||
import com.saltosion.gladiator.util.Name;
|
import com.saltosion.gladiator.util.Name;
|
||||||
@ -16,7 +17,7 @@ public class InGameState extends BaseState {
|
|||||||
* Add new levels to this list
|
* Add new levels to this list
|
||||||
*/
|
*/
|
||||||
private static final Level[] levels = {new Round1Level(), new Round2Level(),
|
private static final Level[] levels = {new Round1Level(), new Round2Level(),
|
||||||
new Round3Level(), new Round4Level()};
|
new Round3Level(), new Round4Level(), new Round5Level()};
|
||||||
|
|
||||||
private Level level;
|
private Level level;
|
||||||
private InGameGUICreator guiCreator;
|
private InGameGUICreator guiCreator;
|
||||||
|
@ -11,6 +11,11 @@ public class Global {
|
|||||||
|
|
||||||
public static final int FLAG_ALIVE = 1;
|
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
|
* Higher font scale = smaller text
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user