added laser shoot sound
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 396 B After Width: | Height: | Size: 503 B |
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 175 B After Width: | Height: | Size: 109 B |
Before Width: | Height: | Size: 432 B After Width: | Height: | Size: 566 B |
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 112 B |
Before Width: | Height: | Size: 419 B After Width: | Height: | Size: 552 B |
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 522 B After Width: | Height: | Size: 714 B |
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 846 B After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 380 B |
Before Width: | Height: | Size: 523 B After Width: | Height: | Size: 300 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 105 B After Width: | Height: | Size: 101 B |
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 90 B |
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 298 B |
BIN
android/assets/sounds/explosion.ogg
Executable file
BIN
android/assets/sounds/laser.ogg
Executable file
@ -130,6 +130,8 @@ public class Polyjet extends Game {
|
|||||||
assetManager.load("flake.png", Texture.class);
|
assetManager.load("flake.png", Texture.class);
|
||||||
assetManager.load("star_bg.png", Texture.class);
|
assetManager.load("star_bg.png", Texture.class);
|
||||||
assetManager.load("void_circle.png", Texture.class);
|
assetManager.load("void_circle.png", Texture.class);
|
||||||
|
assetManager.load("laser.ogg", Sound.class);
|
||||||
|
assetManager.load("explosion.ogg", Sound.class);
|
||||||
}
|
}
|
||||||
public void generateFonts() {
|
public void generateFonts() {
|
||||||
initComplete = true;
|
initComplete = true;
|
||||||
|
@ -3,7 +3,9 @@ package zero1hd.polyjet.entity;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.Preferences;
|
||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
|
import com.badlogic.gdx.audio.Sound;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
@ -19,6 +21,7 @@ import zero1hd.polyjet.entity.enemies.VoidCircle;
|
|||||||
|
|
||||||
public class EntityController {
|
public class EntityController {
|
||||||
AssetManager assets;
|
AssetManager assets;
|
||||||
|
Preferences prefs;
|
||||||
|
|
||||||
public Array<Entity> activeAllies;
|
public Array<Entity> activeAllies;
|
||||||
public Array<Entity> activeEnemies;
|
public Array<Entity> activeEnemies;
|
||||||
@ -33,10 +36,11 @@ public class EntityController {
|
|||||||
//Ally pool declaration;
|
//Ally pool declaration;
|
||||||
private Pool<Laser> laserPool;
|
private Pool<Laser> laserPool;
|
||||||
|
|
||||||
public EntityController(AssetManager assetManager) {
|
public EntityController(AssetManager assetManager, Preferences preferences) {
|
||||||
activeAllies = new Array<Entity>();
|
activeAllies = new Array<Entity>();
|
||||||
activeEnemies = new Array<Entity>();
|
activeEnemies = new Array<Entity>();
|
||||||
this.assets = assetManager;
|
this.assets = assetManager;
|
||||||
|
this.prefs = preferences;
|
||||||
|
|
||||||
//Enemy pool initialization;
|
//Enemy pool initialization;
|
||||||
voidCirclePool = new Pool<VoidCircle>() {
|
voidCirclePool = new Pool<VoidCircle>() {
|
||||||
@ -45,24 +49,28 @@ public class EntityController {
|
|||||||
return new VoidCircle(assets.get("void_circle.png", Texture.class));
|
return new VoidCircle(assets.get("void_circle.png", Texture.class));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pelletPool = new Pool<Pellet>() {
|
pelletPool = new Pool<Pellet>() {
|
||||||
@Override
|
@Override
|
||||||
protected Pellet newObject() {
|
protected Pellet newObject() {
|
||||||
return new Pellet(assets.get("pellet.png", Texture.class));
|
return new Pellet(assets.get("pellet.png", Texture.class));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
shardPool = new Pool<Shard>() {
|
shardPool = new Pool<Shard>() {
|
||||||
@Override
|
@Override
|
||||||
protected Shard newObject() {
|
protected Shard newObject() {
|
||||||
return new Shard(assets.get("shard.png", Texture.class));
|
return new Shard(assets.get("shard.png", Texture.class));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
barPool = new Pool<Bar>() {
|
barPool = new Pool<Bar>() {
|
||||||
@Override
|
@Override
|
||||||
protected Bar newObject() {
|
protected Bar newObject() {
|
||||||
return new Bar(assets.get("bar.png", Texture.class));
|
return new Bar(assets.get("bar.png", Texture.class));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
flakePool = new Pool<Flake>() {
|
flakePool = new Pool<Flake>() {
|
||||||
@Override
|
@Override
|
||||||
protected Flake newObject() {
|
protected Flake newObject() {
|
||||||
@ -74,10 +82,9 @@ public class EntityController {
|
|||||||
laserPool = new Pool<Laser>() {
|
laserPool = new Pool<Laser>() {
|
||||||
@Override
|
@Override
|
||||||
protected Laser newObject() {
|
protected Laser newObject() {
|
||||||
return new Laser(assets.get("laser.png", Texture.class));
|
return new Laser(assets.get("laser.png", Texture.class), assets.get("laser.ogg", Sound.class), prefs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entity retrieveEntity(Entities entity) {
|
public Entity retrieveEntity(Entities entity) {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package zero1hd.polyjet.entity.ally;
|
package zero1hd.polyjet.entity.ally;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Preferences;
|
||||||
|
import com.badlogic.gdx.audio.Sound;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||||
import com.badlogic.gdx.math.Rectangle;
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
@ -15,9 +17,13 @@ public class Laser extends Actor implements Entity, Poolable {
|
|||||||
private float rate;
|
private float rate;
|
||||||
boolean dead;
|
boolean dead;
|
||||||
Texture laserTexture;
|
Texture laserTexture;
|
||||||
|
Sound sfx;
|
||||||
|
Preferences prefs;
|
||||||
|
|
||||||
public Laser(Texture laserTexture) {
|
public Laser(Texture laserTexture, Sound sfx, Preferences prefs) {
|
||||||
this.laserTexture = laserTexture;
|
this.laserTexture = laserTexture;
|
||||||
|
this.sfx = sfx;
|
||||||
|
this.prefs = prefs;
|
||||||
setSize(0.25f, 2f);
|
setSize(0.25f, 2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,6 +33,7 @@ public class Laser extends Actor implements Entity, Poolable {
|
|||||||
this.rate = rate;
|
this.rate = rate;
|
||||||
hitBox = new Rectangle();
|
hitBox = new Rectangle();
|
||||||
hitBox.setSize(getWidth(), getHeight());
|
hitBox.setSize(getWidth(), getHeight());
|
||||||
|
sfx.play(prefs.getFloat("fx vol")/100f);
|
||||||
toBack();
|
toBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,17 +126,16 @@ public class MusicSelectionPage extends Page {
|
|||||||
int prog = (int) (100f*music/(musicFiles.length-1f));
|
int prog = (int) (100f*music/(musicFiles.length-1f));
|
||||||
loadingWindow.setProgress(prog);
|
loadingWindow.setProgress(prog);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadingWindow.remove();
|
loadingWindow.remove();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
NoticeWindow notice = new NoticeWindow(core.getDefaultSkin(), "default", "No song's found in:\n\"" + core.getPrefs().getString("music dir") + "\"\nTo change the search directory, go to game options.");
|
NoticeWindow notice = new NoticeWindow(core.getDefaultSkin(), "default", "No song's found in:\n\"" + core.getPrefs().getString("music dir") + "\"\nTo change the search directory, go to game options.", core.getPrefs().getLong("fx vol"), core.getAssetManager());
|
||||||
notice.setSize(0.6f*getWidth(), 0.6f*getHeight());
|
notice.setSize(0.6f*getWidth(), 0.6f*getHeight());
|
||||||
notice.setPosition((getWidth()-notice.getWidth())/2f, (getHeight()-notice.getHeight())/2f);
|
notice.setPosition((getWidth()-notice.getWidth())/2f, (getHeight()-notice.getHeight())/2f);
|
||||||
notice.setModal(true);
|
notice.setModal(true);
|
||||||
notice.setMovable(false);
|
notice.setMovable(false);
|
||||||
loadingWindow.remove();
|
loadingWindow.remove();
|
||||||
addActor(notice);
|
addActor(notice);
|
||||||
|
notice.playOpenSound();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
@ -3,12 +3,9 @@ package zero1hd.polyjet.ui.stages;
|
|||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Preferences;
|
import com.badlogic.gdx.Preferences;
|
||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.Camera;
|
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
|
||||||
import com.badlogic.gdx.graphics.Pixmap.Format;
|
import com.badlogic.gdx.graphics.Pixmap.Format;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
|
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
|
||||||
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
|
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
|
||||||
@ -39,10 +36,11 @@ public class GamePlayArea extends Stage {
|
|||||||
private int score;
|
private int score;
|
||||||
|
|
||||||
private ShaderProgram glowShader;
|
private ShaderProgram glowShader;
|
||||||
private ShaderProgram bgShader;
|
|
||||||
private FrameBuffer blurTarget;
|
private FrameBuffer blurTarget;
|
||||||
TextureRegion fboRegion;
|
TextureRegion fboRegion;
|
||||||
private int fboSize;
|
private int fboSize;
|
||||||
|
|
||||||
|
private ShaderProgram bgShader;
|
||||||
private Texture background;
|
private Texture background;
|
||||||
|
|
||||||
private float time;
|
private float time;
|
||||||
@ -53,7 +51,7 @@ public class GamePlayArea extends Stage {
|
|||||||
background = assetManager.get("star_bg.png");
|
background = assetManager.get("star_bg.png");
|
||||||
|
|
||||||
polyjet = new PolyJetEntity(assetManager, 25f, 25f, "standard");
|
polyjet = new PolyJetEntity(assetManager, 25f, 25f, "standard");
|
||||||
ec = new EntityController(assetManager);
|
ec = new EntityController(assetManager, prefs);
|
||||||
collisionDetector = new CollisionDetector(ec.activeAllies, ec.activeEnemies);
|
collisionDetector = new CollisionDetector(ec.activeAllies, ec.activeEnemies);
|
||||||
ec.activeAllies.add(polyjet);
|
ec.activeAllies.add(polyjet);
|
||||||
addActor(polyjet);
|
addActor(polyjet);
|
||||||
@ -123,6 +121,8 @@ public class GamePlayArea extends Stage {
|
|||||||
getBatch().draw(background, 0f, 0f, Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT);
|
getBatch().draw(background, 0f, 0f, Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT);
|
||||||
getBatch().end();
|
getBatch().end();
|
||||||
|
|
||||||
|
getBatch().setShader(null);
|
||||||
|
|
||||||
if (glowShader != null) {
|
if (glowShader != null) {
|
||||||
blurTarget.begin();
|
blurTarget.begin();
|
||||||
|
|
||||||
@ -130,7 +130,6 @@ public class GamePlayArea extends Stage {
|
|||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
getBatch().setBlendFunction(-1, -1);
|
getBatch().setBlendFunction(-1, -1);
|
||||||
Gdx.gl20.glBlendFuncSeparate(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA,GL20.GL_ONE, GL20.GL_DST_ALPHA);
|
Gdx.gl20.glBlendFuncSeparate(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA,GL20.GL_ONE, GL20.GL_DST_ALPHA);
|
||||||
getBatch().setShader(null);
|
|
||||||
super.draw();
|
super.draw();
|
||||||
blurTarget.end(getViewport().getScreenX(), getViewport().getScreenY(), getViewport().getScreenWidth(), getViewport().getScreenHeight());
|
blurTarget.end(getViewport().getScreenX(), getViewport().getScreenY(), getViewport().getScreenWidth(), getViewport().getScreenHeight());
|
||||||
getBatch().setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
getBatch().setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
@ -144,7 +143,6 @@ public class GamePlayArea extends Stage {
|
|||||||
getBatch().end();
|
getBatch().end();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
getBatch().setShader(null);
|
|
||||||
super.draw();
|
super.draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,6 +263,13 @@ public class GamePlayArea extends Stage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
if (glowShader != null) {
|
||||||
|
blurTarget.dispose();
|
||||||
|
glowShader.dispose();
|
||||||
|
}
|
||||||
|
if (bgShader != null) {
|
||||||
|
bgShader.dispose();
|
||||||
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ public class LoadingWindow extends Window implements Disposable {
|
|||||||
closeSound.play(vol/100f);
|
closeSound.play(vol/100f);
|
||||||
return super.remove();
|
return super.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProgress(float progress) {
|
public void setProgress(float progress) {
|
||||||
status.setText(String.valueOf((int) progress) + '%');
|
status.setText(String.valueOf((int) progress) + '%');
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package zero1hd.polyjet.ui.windows;
|
package zero1hd.polyjet.ui.windows;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
|
import com.badlogic.gdx.audio.Sound;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
@ -10,20 +12,32 @@ import com.badlogic.gdx.utils.Align;
|
|||||||
public class NoticeWindow extends Window {
|
public class NoticeWindow extends Window {
|
||||||
private Label noticeText;
|
private Label noticeText;
|
||||||
private Skin skin;
|
private Skin skin;
|
||||||
public NoticeWindow(Skin skin, String styleName, String text) {
|
|
||||||
|
private Sound closeSound;
|
||||||
|
private Sound openSound;
|
||||||
|
private float vol;
|
||||||
|
public NoticeWindow(Skin skin, String styleName, String text, float vol, AssetManager assets) {
|
||||||
super("Notice", skin, "tinted");
|
super("Notice", skin, "tinted");
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
|
|
||||||
|
this.openSound = assets.get("pop_open.ogg", Sound.class);
|
||||||
|
this.closeSound = assets.get("pop_close.ogg", Sound.class);
|
||||||
|
this.vol = vol;
|
||||||
|
|
||||||
noticeText = new Label(text, skin, "sub-font", skin.getColor("default"));
|
noticeText = new Label(text, skin, "sub-font", skin.getColor("default"));
|
||||||
noticeText.setWrap(true);
|
noticeText.setWrap(true);
|
||||||
noticeText.setAlignment(Align.center);
|
noticeText.setAlignment(Align.center);
|
||||||
add(noticeText).expandX().fill().center().padLeft(20f).padRight(20f);
|
add(noticeText).expandX().fill().center().padLeft(20f).padRight(20f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NoticeWindow(Skin skin, String styleName, String title, String text) {
|
public NoticeWindow(Skin skin, String styleName, String title, String text, float vol, AssetManager assets) {
|
||||||
super(title, skin, styleName);
|
super(title, skin, styleName);
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
|
|
||||||
|
this.openSound = assets.get("pop_open.ogg", Sound.class);
|
||||||
|
this.closeSound = assets.get("pop_close.ogg", Sound.class);
|
||||||
|
this.vol = vol;
|
||||||
|
|
||||||
noticeText = new Label(text, skin, "sub-font", skin.getColor("default"));
|
noticeText = new Label(text, skin, "sub-font", skin.getColor("default"));
|
||||||
noticeText.setWrap(true);
|
noticeText.setWrap(true);
|
||||||
noticeText.setAlignment(Align.center);
|
noticeText.setAlignment(Align.center);
|
||||||
@ -36,4 +50,14 @@ public class NoticeWindow extends Window {
|
|||||||
add(button).align(alignment);
|
add(button).align(alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void playOpenSound() {
|
||||||
|
openSound.play(vol/100f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean remove() {
|
||||||
|
closeSound.play(vol/100f);
|
||||||
|
return super.remove();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|