prepared for explosion effects and added disintegrate sound fx
This commit is contained in:
parent
647b3b7d14
commit
7e1c955c8b
BIN
android/assets/sounds/disintegrate.ogg
Executable file
BIN
android/assets/sounds/disintegrate.ogg
Executable file
Binary file not shown.
Binary file not shown.
@ -132,6 +132,8 @@ public class Polyjet extends Game {
|
||||
assetManager.load("void_circle.png", Texture.class);
|
||||
assetManager.load("laser.ogg", Sound.class);
|
||||
assetManager.load("explosion.ogg", Sound.class);
|
||||
assetManager.load("disintegrate.ogg", Sound.class);
|
||||
assetManager.load("explosion-s.p", ParticleEffect.class);
|
||||
}
|
||||
public void generateFonts() {
|
||||
initComplete = true;
|
||||
|
@ -7,6 +7,8 @@ import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.assets.AssetManager;
|
||||
import com.badlogic.gdx.audio.Sound;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.ParticleEffect;
|
||||
import com.badlogic.gdx.graphics.g2d.ParticleEffectPool;
|
||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Pool;
|
||||
@ -26,6 +28,9 @@ public class EntityController {
|
||||
public Array<Entity> activeAllies;
|
||||
public Array<Entity> activeEnemies;
|
||||
|
||||
//Particle pools;
|
||||
ParticleEffectPool explosionEffectPool;
|
||||
|
||||
//Enemy pool declaration;
|
||||
private Pool<VoidCircle> voidCirclePool;
|
||||
private Pool<Pellet> pelletPool;
|
||||
@ -42,11 +47,13 @@ public class EntityController {
|
||||
this.assets = assetManager;
|
||||
this.prefs = preferences;
|
||||
|
||||
explosionEffectPool = new ParticleEffectPool(assets.get("explosion-s.p", ParticleEffect.class), 1, 64);
|
||||
|
||||
//Enemy pool initialization;
|
||||
voidCirclePool = new Pool<VoidCircle>() {
|
||||
@Override
|
||||
protected VoidCircle newObject() {
|
||||
return new VoidCircle(assets.get("void_circle.png", Texture.class));
|
||||
return new VoidCircle(assets.get("void_circle.png", Texture.class), assets.get("disintegrate.ogg", Sound.class), prefs);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package zero1hd.polyjet.entity.enemies;
|
||||
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.audio.Sound;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
@ -23,9 +25,15 @@ public class VoidCircle extends Actor implements Entity, Poolable {
|
||||
private boolean begin;
|
||||
private Vector2 center;
|
||||
private float maxTime;
|
||||
public VoidCircle(Texture voidTexture) {
|
||||
private Sound sound;
|
||||
private Preferences prefs;
|
||||
|
||||
public VoidCircle(Texture voidTexture, Sound sound, Preferences prefs) {
|
||||
hitBox = new Rectangle();
|
||||
center = new Vector2();
|
||||
this.sound = sound;
|
||||
this.prefs = prefs;
|
||||
|
||||
voidCircleTexture = new Sprite(voidTexture);
|
||||
}
|
||||
|
||||
@ -112,6 +120,13 @@ public VoidCircle(Texture voidTexture) {
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
switch (entity.getEntityType()) {
|
||||
case LASER:
|
||||
sound.play(prefs.getFloat("fx vol"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user