Added sounds to actions. (Credit: Allexit)
This commit is contained in:
parent
814f9c9788
commit
43150f0de1
@ -29,6 +29,9 @@ public class CPhysics extends Component {
|
|||||||
// Stores information about the direction last time moved in
|
// Stores information about the direction last time moved in
|
||||||
public boolean movedLeftLast = false;
|
public boolean movedLeftLast = false;
|
||||||
|
|
||||||
|
// Stores a float that tells how long the physics object must wait until it can play sounds with it's walking again.
|
||||||
|
public float stepCD = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param movable Toggles if the entity can move by itself
|
* @param movable Toggles if the entity can move by itself
|
||||||
* @return Returns the instance this methdod was called from
|
* @return Returns the instance this methdod was called from
|
||||||
|
@ -31,10 +31,12 @@ public class GameOverGUICreator implements GUICreator {
|
|||||||
SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) {
|
SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) {
|
||||||
@Override
|
@Override
|
||||||
public void pressed(int x, int y, int mouseButton) {
|
public void pressed(int x, int y, int mouseButton) {
|
||||||
|
playButtonPressSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void released(int x, int y, int mouseButton) {
|
public void released(int x, int y, int mouseButton) {
|
||||||
|
playButtonReleaseSound();
|
||||||
shouldReturn = true;
|
shouldReturn = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -27,10 +27,12 @@ public class MainMenuGUICreator implements GUICreator {
|
|||||||
SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) {
|
SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) {
|
||||||
@Override
|
@Override
|
||||||
public void pressed(int x, int y, int mouseButton) {
|
public void pressed(int x, int y, int mouseButton) {
|
||||||
|
playButtonPressSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void released(int x, int y, int mouseButton) {
|
public void released(int x, int y, int mouseButton) {
|
||||||
|
playButtonReleaseSound();
|
||||||
shouldPlay = true;
|
shouldPlay = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -31,10 +31,12 @@ public class WinGUICreator implements GUICreator {
|
|||||||
SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) {
|
SpriteLoader.loadSprite(Name.BUTTON_BIG_HOVER)) {
|
||||||
@Override
|
@Override
|
||||||
public void pressed(int x, int y, int mouseButton) {
|
public void pressed(int x, int y, int mouseButton) {
|
||||||
|
playButtonPressSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void released(int x, int y, int mouseButton) {
|
public void released(int x, int y, int mouseButton) {
|
||||||
|
playButtonReleaseSound();
|
||||||
shouldReturn = true;
|
shouldReturn = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,9 @@ import com.saltosion.gladiator.gui.properties.ImageProperty;
|
|||||||
import com.saltosion.gladiator.gui.properties.InteractiveProperty;
|
import com.saltosion.gladiator.gui.properties.InteractiveProperty;
|
||||||
import com.saltosion.gladiator.gui.nodes.GUINode;
|
import com.saltosion.gladiator.gui.nodes.GUINode;
|
||||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||||
|
import com.saltosion.gladiator.util.AppUtil;
|
||||||
|
import com.saltosion.gladiator.util.AudioLoader;
|
||||||
|
import com.saltosion.gladiator.util.Name;
|
||||||
|
|
||||||
public abstract class ButtonNode extends GUINode implements InteractiveProperty, ImageProperty {
|
public abstract class ButtonNode extends GUINode implements InteractiveProperty, ImageProperty {
|
||||||
private final Sprite onHover;
|
private final Sprite onHover;
|
||||||
@ -16,6 +19,16 @@ public abstract class ButtonNode extends GUINode implements InteractiveProperty,
|
|||||||
this.normal = normal;
|
this.normal = normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void playButtonPressSound() {
|
||||||
|
AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_BUTTON_PRESS),
|
||||||
|
AppUtil.sfxVolume/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void playButtonReleaseSound() {
|
||||||
|
AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_BUTTON_RELEASE),
|
||||||
|
AppUtil.sfxVolume/2);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseEnter(float x, float y) {
|
public void mouseEnter(float x, float y) {
|
||||||
hovered = true;
|
hovered = true;
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package com.saltosion.gladiator.listeners;
|
package com.saltosion.gladiator.listeners;
|
||||||
|
|
||||||
import com.badlogic.ashley.core.Entity;
|
import com.badlogic.ashley.core.Entity;
|
||||||
|
import com.badlogic.gdx.audio.Sound;
|
||||||
import com.saltosion.gladiator.components.CParticle;
|
import com.saltosion.gladiator.components.CParticle;
|
||||||
import com.saltosion.gladiator.components.CPhysics;
|
import com.saltosion.gladiator.components.CPhysics;
|
||||||
import com.saltosion.gladiator.util.AppUtil;
|
import com.saltosion.gladiator.util.AppUtil;
|
||||||
|
import com.saltosion.gladiator.util.AudioLoader;
|
||||||
import com.saltosion.gladiator.util.Global;
|
import com.saltosion.gladiator.util.Global;
|
||||||
|
import com.saltosion.gladiator.util.Name;
|
||||||
|
|
||||||
public class BasicDeathListener implements CombatListener {
|
public class BasicDeathListener implements CombatListener {
|
||||||
|
|
||||||
@ -16,6 +19,14 @@ public class BasicDeathListener implements CombatListener {
|
|||||||
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),
|
||||||
|
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 < FX_DEAD_AMT; 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)
|
||||||
@ -31,6 +42,14 @@ 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),
|
||||||
|
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 < FX_HIT_AMT; 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)
|
||||||
|
@ -4,10 +4,14 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import com.badlogic.ashley.core.ComponentMapper;
|
import com.badlogic.ashley.core.ComponentMapper;
|
||||||
import com.badlogic.ashley.core.Entity;
|
import com.badlogic.ashley.core.Entity;
|
||||||
|
import com.badlogic.gdx.audio.Sound;
|
||||||
import com.saltosion.gladiator.components.CCombat;
|
import com.saltosion.gladiator.components.CCombat;
|
||||||
import com.saltosion.gladiator.components.CPhysics;
|
import com.saltosion.gladiator.components.CPhysics;
|
||||||
import com.saltosion.gladiator.systems.CombatSystem;
|
import com.saltosion.gladiator.systems.CombatSystem;
|
||||||
|
import com.saltosion.gladiator.util.AppUtil;
|
||||||
|
import com.saltosion.gladiator.util.AudioLoader;
|
||||||
import com.saltosion.gladiator.util.Direction;
|
import com.saltosion.gladiator.util.Direction;
|
||||||
|
import com.saltosion.gladiator.util.Name;
|
||||||
|
|
||||||
public class SwingHitboxListener implements CollisionListener {
|
public class SwingHitboxListener implements CollisionListener {
|
||||||
|
|
||||||
@ -46,6 +50,12 @@ public class SwingHitboxListener implements CollisionListener {
|
|||||||
}
|
}
|
||||||
float force = cm.get(source).getSwingForce();
|
float force = cm.get(source).getSwingForce();
|
||||||
pm.get(source).setSimVelocity(x * force, 0);
|
pm.get(source).setSimVelocity(x * force, 0);
|
||||||
|
|
||||||
|
Sound s = AppUtil.jukebox.returnRandomSound(AudioLoader.getSound(Name.SOUND_CLANG01),
|
||||||
|
AudioLoader.getSound(Name.SOUND_CLANG02),
|
||||||
|
AudioLoader.getSound(Name.SOUND_CLANG03),
|
||||||
|
AudioLoader.getSound(Name.SOUND_CLANG04));
|
||||||
|
s.play(AppUtil.sfxVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ import com.saltosion.gladiator.level.Level;
|
|||||||
import com.saltosion.gladiator.level.premade.Round1Level;
|
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.util.AppUtil;
|
import com.saltosion.gladiator.util.AppUtil;
|
||||||
|
import com.saltosion.gladiator.util.AudioLoader;
|
||||||
|
import com.saltosion.gladiator.util.Name;
|
||||||
|
|
||||||
public class InGameState extends BaseState {
|
public class InGameState extends BaseState {
|
||||||
|
|
||||||
@ -29,6 +31,10 @@ public class InGameState extends BaseState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
|
// Play music
|
||||||
|
AppUtil.jukebox.playMusic(AudioLoader.getMusic(Name.MUSIC_BATTLE));
|
||||||
|
AppUtil.jukebox.setMusicVolume(AppUtil.musicVolume/2);
|
||||||
|
|
||||||
// Start from a clean slate
|
// Start from a clean slate
|
||||||
AppUtil.engine.removeAllEntities();
|
AppUtil.engine.removeAllEntities();
|
||||||
AppUtil.guiManager.clearGUI();
|
AppUtil.guiManager.clearGUI();
|
||||||
|
@ -2,6 +2,8 @@ package com.saltosion.gladiator.state;
|
|||||||
|
|
||||||
import com.saltosion.gladiator.gui.creators.MainMenuGUICreator;
|
import com.saltosion.gladiator.gui.creators.MainMenuGUICreator;
|
||||||
import com.saltosion.gladiator.util.AppUtil;
|
import com.saltosion.gladiator.util.AppUtil;
|
||||||
|
import com.saltosion.gladiator.util.AudioLoader;
|
||||||
|
import com.saltosion.gladiator.util.Name;
|
||||||
|
|
||||||
public class MainMenuState extends BaseState {
|
public class MainMenuState extends BaseState {
|
||||||
|
|
||||||
@ -9,6 +11,10 @@ public class MainMenuState extends BaseState {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
|
// Play music
|
||||||
|
AppUtil.jukebox.playMusic(AudioLoader.getMusic(Name.MUSIC_THEME));
|
||||||
|
AppUtil.jukebox.setMusicVolume(AppUtil.musicVolume);
|
||||||
|
|
||||||
// Start from a clean slate
|
// Start from a clean slate
|
||||||
AppUtil.guiManager.clearGUI();
|
AppUtil.guiManager.clearGUI();
|
||||||
|
|
||||||
|
@ -6,18 +6,17 @@ import com.badlogic.ashley.core.Entity;
|
|||||||
import com.badlogic.ashley.core.EntitySystem;
|
import com.badlogic.ashley.core.EntitySystem;
|
||||||
import com.badlogic.ashley.core.Family;
|
import com.badlogic.ashley.core.Family;
|
||||||
import com.badlogic.ashley.utils.ImmutableArray;
|
import com.badlogic.ashley.utils.ImmutableArray;
|
||||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
import com.badlogic.gdx.audio.Sound;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.saltosion.gladiator.components.CCombat;
|
import com.saltosion.gladiator.components.CCombat;
|
||||||
import com.saltosion.gladiator.components.CDestructive;
|
import com.saltosion.gladiator.components.CDestructive;
|
||||||
import com.saltosion.gladiator.components.CPhysics;
|
import com.saltosion.gladiator.components.CPhysics;
|
||||||
import com.saltosion.gladiator.components.CRenderedObject;
|
|
||||||
import com.saltosion.gladiator.listeners.CombatListener;
|
import com.saltosion.gladiator.listeners.CombatListener;
|
||||||
import com.saltosion.gladiator.listeners.SwingHitboxListener;
|
import com.saltosion.gladiator.listeners.SwingHitboxListener;
|
||||||
import com.saltosion.gladiator.util.AppUtil;
|
import com.saltosion.gladiator.util.AppUtil;
|
||||||
|
import com.saltosion.gladiator.util.AudioLoader;
|
||||||
import com.saltosion.gladiator.util.Direction;
|
import com.saltosion.gladiator.util.Direction;
|
||||||
import com.saltosion.gladiator.util.Name;
|
import com.saltosion.gladiator.util.Name;
|
||||||
import com.saltosion.gladiator.util.SpriteLoader;
|
|
||||||
|
|
||||||
public class CombatSystem extends EntitySystem {
|
public class CombatSystem extends EntitySystem {
|
||||||
|
|
||||||
@ -60,6 +59,8 @@ public class CombatSystem extends EntitySystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!combat.getSwing().isZero() && combat.swingCdCounter <= 0) {
|
if (!combat.getSwing().isZero() && combat.swingCdCounter <= 0) {
|
||||||
|
|
||||||
|
// Swinging
|
||||||
Vector2 pos = obj.getPosition().cpy();
|
Vector2 pos = obj.getPosition().cpy();
|
||||||
|
|
||||||
if (combat.getSwingDirection() == Direction.LEFT) {
|
if (combat.getSwingDirection() == Direction.LEFT) {
|
||||||
@ -73,6 +74,15 @@ public class CombatSystem extends EntitySystem {
|
|||||||
}
|
}
|
||||||
createSwingHitbox(e, combat.getSwingDirection(), pos);
|
createSwingHitbox(e, combat.getSwingDirection(), pos);
|
||||||
|
|
||||||
|
// SFX
|
||||||
|
|
||||||
|
Sound s = AppUtil.jukebox.returnRandomSound(AudioLoader.getSound(Name.SOUND_SWING01),
|
||||||
|
AudioLoader.getSound(Name.SOUND_SWING02),
|
||||||
|
AudioLoader.getSound(Name.SOUND_SWING03));
|
||||||
|
s.play(AppUtil.sfxVolume);
|
||||||
|
|
||||||
|
// After-swing
|
||||||
|
|
||||||
combat.swingCdCounter = combat.getSwingDuration();
|
combat.swingCdCounter = combat.getSwingDuration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,11 @@ import com.badlogic.ashley.core.Family;
|
|||||||
import com.badlogic.ashley.utils.ImmutableArray;
|
import com.badlogic.ashley.utils.ImmutableArray;
|
||||||
import com.saltosion.gladiator.components.CCombat;
|
import com.saltosion.gladiator.components.CCombat;
|
||||||
import com.saltosion.gladiator.components.CPhysics;
|
import com.saltosion.gladiator.components.CPhysics;
|
||||||
|
import com.saltosion.gladiator.util.AppUtil;
|
||||||
|
import com.saltosion.gladiator.util.AudioLoader;
|
||||||
import com.saltosion.gladiator.util.Direction;
|
import com.saltosion.gladiator.util.Direction;
|
||||||
import com.saltosion.gladiator.util.Log;
|
import com.saltosion.gladiator.util.Log;
|
||||||
|
import com.saltosion.gladiator.util.Name;
|
||||||
|
|
||||||
public class PhysicsSystem extends EntitySystem {
|
public class PhysicsSystem extends EntitySystem {
|
||||||
|
|
||||||
@ -58,6 +61,9 @@ public class PhysicsSystem extends EntitySystem {
|
|||||||
if (obj.jumping && obj.isGrounded()) {
|
if (obj.jumping && obj.isGrounded()) {
|
||||||
obj.setGrounded(false);
|
obj.setGrounded(false);
|
||||||
obj.getVelocity().y = obj.getJumpForce();
|
obj.getVelocity().y = obj.getJumpForce();
|
||||||
|
|
||||||
|
// Sound effect!
|
||||||
|
AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_STEP), AppUtil.sfxVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.getVelocity().x += obj.getSimVelocity().x;
|
obj.getVelocity().x += obj.getSimVelocity().x;
|
||||||
|
@ -28,6 +28,7 @@ import com.saltosion.gladiator.gui.properties.ImageProperty;
|
|||||||
import com.saltosion.gladiator.gui.nodes.TextNode;
|
import com.saltosion.gladiator.gui.nodes.TextNode;
|
||||||
import com.saltosion.gladiator.gui.properties.TextProperty;
|
import com.saltosion.gladiator.gui.properties.TextProperty;
|
||||||
import com.saltosion.gladiator.util.AppUtil;
|
import com.saltosion.gladiator.util.AppUtil;
|
||||||
|
import com.saltosion.gladiator.util.AudioLoader;
|
||||||
import com.saltosion.gladiator.util.Global;
|
import com.saltosion.gladiator.util.Global;
|
||||||
import com.saltosion.gladiator.util.Name;
|
import com.saltosion.gladiator.util.Name;
|
||||||
import com.saltosion.gladiator.util.SpriteLoader;
|
import com.saltosion.gladiator.util.SpriteLoader;
|
||||||
@ -101,7 +102,7 @@ public class RenderingSystem extends EntitySystem {
|
|||||||
Gdx.gl.glClearColor(0, 0, 0, 0);
|
Gdx.gl.glClearColor(0, 0, 0, 0);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
updateEntityAnimations();
|
updateEntityAnimations(deltaTime);
|
||||||
renderEntities(deltaTime);
|
renderEntities(deltaTime);
|
||||||
renderParticles();
|
renderParticles();
|
||||||
renderDebug();
|
renderDebug();
|
||||||
@ -134,13 +135,13 @@ public class RenderingSystem extends EntitySystem {
|
|||||||
return deltaString;
|
return deltaString;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateEntityAnimations() {
|
private void updateEntityAnimations(float deltaTime) {
|
||||||
for (int i = 0; i < entities.size(); i++) {
|
for (int i = 0; i < entities.size(); i++) {
|
||||||
updateEntityAnimation(entities.get(i));
|
updateEntityAnimation(entities.get(i), deltaTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateEntityAnimation(Entity entity) {
|
private void updateEntityAnimation(Entity entity, float deltaTime) {
|
||||||
CRenderedObject ro = rom.get(entity);
|
CRenderedObject ro = rom.get(entity);
|
||||||
CPhysics po = pm.get(entity);
|
CPhysics po = pm.get(entity);
|
||||||
CCombat co = cm.get(entity);
|
CCombat co = cm.get(entity);
|
||||||
@ -184,22 +185,36 @@ public class RenderingSystem extends EntitySystem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play animations
|
// Play animations & play sounds
|
||||||
|
if (po.stepCD > 0) {
|
||||||
|
po.stepCD -= deltaTime;
|
||||||
|
}
|
||||||
|
|
||||||
if (moving && combat) {
|
if (moving && combat) {
|
||||||
ro.playAnimation("torso", "Torso-Combat-" + dirSwing);
|
ro.playAnimation("torso", "Torso-Combat-" + dirSwing);
|
||||||
ro.playAnimation("legs", "Legs-Run-" + dirMove);
|
ro.playAnimation("legs", "Legs-Run-" + dirMove);
|
||||||
|
tryToMakeStepSound(po);
|
||||||
} else if (combat) {
|
} else if (combat) {
|
||||||
ro.playAnimation("torso", "Torso-Combat-" + dirSwing);
|
ro.playAnimation("torso", "Torso-Combat-" + dirSwing);
|
||||||
ro.playAnimation("legs", "Legs-Idle-" + dirMove);
|
ro.playAnimation("legs", "Legs-Idle-" + dirMove);
|
||||||
} else if (moving) {
|
} else if (moving) {
|
||||||
ro.playAnimation("torso", "Torso-Run-" + dirMove);
|
ro.playAnimation("torso", "Torso-Run-" + dirMove);
|
||||||
ro.playAnimation("legs", "Legs-Run-" + dirMove);
|
ro.playAnimation("legs", "Legs-Run-" + dirMove);
|
||||||
|
tryToMakeStepSound(po);
|
||||||
} else {
|
} else {
|
||||||
ro.playAnimation("torso", "Torso-Idle-" + dirMove);
|
ro.playAnimation("torso", "Torso-Idle-" + dirMove);
|
||||||
ro.playAnimation("legs", "Legs-Idle-" + dirMove);
|
ro.playAnimation("legs", "Legs-Idle-" + dirMove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tryToMakeStepSound(CPhysics po) {
|
||||||
|
if (po.stepCD > 0 || !po.isGrounded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
po.stepCD = 0.3f;
|
||||||
|
AppUtil.jukebox.playSound(AudioLoader.getSound(Name.SOUND_STEP), AppUtil.sfxVolume/3*2);
|
||||||
|
}
|
||||||
|
|
||||||
private void renderEntities(float deltaTime) {
|
private void renderEntities(float deltaTime) {
|
||||||
if (AppUtil.player == null) {
|
if (AppUtil.player == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -18,5 +18,8 @@ public class AppUtil {
|
|||||||
|
|
||||||
public static final int VPHEIGHT_CONST = 24;
|
public static final int VPHEIGHT_CONST = 24;
|
||||||
|
|
||||||
|
public static float sfxVolume = 0.3f;
|
||||||
|
public static float musicVolume = 0.7f;
|
||||||
|
|
||||||
public static final Vector2 JUMP_FORCE = new Vector2(0, 12000);
|
public static final Vector2 JUMP_FORCE = new Vector2(0, 12000);
|
||||||
}
|
}
|
||||||
|
@ -72,4 +72,8 @@ public class Jukebox {
|
|||||||
sound.setPan(id, pan, volume);
|
sound.setPan(id, pan, volume);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Sound returnRandomSound(Sound ... args) {
|
||||||
|
return args[(int) Math.floor(Math.random()*args.length)];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user