new texture added and everything resized; worked on spawning and collision checking

This commit is contained in:
Harrison Deng 2017-05-31 13:49:18 -05:00
parent 5776586458
commit 70bf120a5f
67 changed files with 73 additions and 33 deletions

0
android/assets/1280x720/PolyjetTitle.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

0
android/assets/1280x720/Tech-Circle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

0
android/assets/1280x720/cybercircle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

0
android/assets/1280x720/cybercircle3B.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

0
android/assets/1280x720/polyjet-standard.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 364 B

0
android/assets/1280x720/splashlogo.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

0
android/assets/1280x720/square.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 96 B

After

Width:  |  Height:  |  Size: 96 B

0
android/assets/1280x800/PolyjetTitle.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

0
android/assets/1280x800/Tech-Circle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

0
android/assets/1280x800/cybercircle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

0
android/assets/1280x800/cybercircle3B.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

0
android/assets/1280x800/polyjet-standard.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

0
android/assets/1280x800/splashlogo.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

0
android/assets/1280x800/square.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 100 B

After

Width:  |  Height:  |  Size: 100 B

0
android/assets/1366x768/PolyjetTitle.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

0
android/assets/1366x768/Tech-Circle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

0
android/assets/1366x768/cybercircle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

0
android/assets/1366x768/cybercircle3B.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

0
android/assets/1366x768/polyjet-standard.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 421 B

0
android/assets/1366x768/splashlogo.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

0
android/assets/1366x768/square.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 98 B

After

Width:  |  Height:  |  Size: 98 B

0
android/assets/1920x1080/PolyjetTitle.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
android/assets/1920x1080/Tech-Circle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

0
android/assets/1920x1080/cybercircle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

0
android/assets/1920x1080/cybercircle3B.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

0
android/assets/1920x1080/polyjet-standard.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 378 B

0
android/assets/1920x1080/splashlogo.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

0
android/assets/1920x1080/square.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 114 B

0
android/assets/1920x1200/PolyjetTitle.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

0
android/assets/1920x1200/Tech-Circle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

0
android/assets/1920x1200/cybercircle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

0
android/assets/1920x1200/cybercircle3B.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

0
android/assets/1920x1200/polyjet-standard.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 839 B

After

Width:  |  Height:  |  Size: 839 B

0
android/assets/1920x1200/splashlogo.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

0
android/assets/1920x1200/square.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 122 B

After

Width:  |  Height:  |  Size: 122 B

0
android/assets/2560x1440/PolyjetTitle.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

0
android/assets/2560x1440/Tech-Circle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 123 KiB

0
android/assets/2560x1440/cybercircle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

0
android/assets/2560x1440/cybercircle3B.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

0
android/assets/2560x1440/polyjet-standard.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1022 B

After

Width:  |  Height:  |  Size: 1022 B

0
android/assets/2560x1440/splashlogo.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

0
android/assets/2560x1440/square.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

0
android/assets/800x480/PolyjetTitle.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

0
android/assets/800x480/Tech-Circle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

0
android/assets/800x480/cybercircle1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

0
android/assets/800x480/cybercircle3B.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

0
android/assets/800x480/polyjet-standard.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 266 B

After

Width:  |  Height:  |  Size: 266 B

0
android/assets/800x480/splashlogo.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

0
android/assets/800x480/square.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 84 B

After

Width:  |  Height:  |  Size: 84 B

View File

@ -123,6 +123,7 @@ public class Polyjet extends Game {
assetManager.load("teleport-cloak.p", ParticleEffect.class);
assetManager.load("pop_open.ogg", Sound.class);
assetManager.load("pop_close.ogg", Sound.class);
assetManager.load("laser.png", Texture.class);
}
public void generateFonts() {
initComplete = true;

View File

@ -1,24 +1,31 @@
package zero1hd.polyjet.entity;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
public class CollisionDetector {
Array<Entity> firstGroup;
Array<Entity> secondGroup;
private boolean debug = true;
public CollisionDetector(Array<Entity> firstGroup, Array<Entity> secondGroup) {
this.firstGroup = firstGroup;
this.secondGroup = secondGroup;
}
public void collisionCheck() {
while (firstGroup.iterator().hasNext()) {
Entity firstEntity = firstGroup.iterator().next();
while (secondGroup.iterator().hasNext()) {
Entity secondEntity = secondGroup.iterator().next();
if (firstEntity.getHitZone().overlaps(secondEntity.getHitZone())) {
firstEntity.collided(secondEntity);
secondEntity.collided(firstEntity);
if (debug) {
Gdx.app.debug("collision check", "First group size: " + firstGroup.size);
Gdx.app.debug("collision check", "Second group size: " + secondGroup.size);
}
for (int firstEID = 0; firstEID < firstGroup.size; firstEID++) {
for (int secondEID = 0; secondEID < secondGroup.size; secondEID++) {
if (firstGroup.get(firstEID).getHitZone().overlaps(secondGroup.get(secondEID).getHitZone())) {
firstGroup.get(firstEID).collided(secondGroup.get(secondEID));
secondGroup.get(secondEID).collided(firstGroup.get(firstEID));
}
}
}

View File

@ -1,5 +1,6 @@
package zero1hd.polyjet.entity;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
@ -23,6 +24,8 @@ public class EntityController {
public EntityController(ShapeRenderer shapeRenderer, AssetManager assetManager) {
ACTIVE_ALLIES = new Array<Entity>();
ACTIVE_ENEMIES = new Array<Entity>();
this.assets = assetManager;
this.shapes = shapeRenderer;
//Enemy pool initialization;
VOID_CIRCLE_POOL = new Pool<VoidCircle>() {
@ -43,6 +46,7 @@ public class EntityController {
}
public Entity retrieveEntity(Entities entity) {
Gdx.app.debug("EntityController", "spawning entity " + entity.name());
switch (entity) {
case VOID_CIRCLE:
VoidCircle voidCircle = VOID_CIRCLE_POOL.obtain();

View File

@ -24,7 +24,7 @@ public class Laser extends Actor implements Entity, Poolable {
setX(x);
setY(y);
this.rate = rate;
setSize(0.25f, 2f);
setSize(0.25f, 1f);
hitBox = new Rectangle();
hitBox.setSize(getWidth(), getHeight());
}

View File

@ -1,5 +1,6 @@
package zero1hd.polyjet.entity.enemies;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
@ -12,20 +13,21 @@ import zero1hd.polyjet.entity.Entities;
import zero1hd.polyjet.entity.Entity;
public class VoidCircle extends Actor implements Entity, Poolable {
float timer;
float endRadius;
private float timer;
private float endRadius;
private float currentRadius;
Rectangle hitBox;
ShapeRenderer shapeRenderer;
float growthRate;
boolean done;
public VoidCircle(ShapeRenderer shapeRenderer) {
private Rectangle hitBox;
private ShapeRenderer shapeRenderer;
private float growthRate;
private boolean done;
private boolean begin;
public VoidCircle(ShapeRenderer shapeRenderer) {
hitBox = new Rectangle();
this.shapeRenderer = shapeRenderer;
}
public void init(float endRadius, float x, float y, float growthRate, float warningTime) {
Gdx.app.debug("Void Circle", "Initiated.");
timer = warningTime;
this.endRadius = endRadius;
setSize(2*endRadius, 2*endRadius);
@ -40,6 +42,7 @@ public class VoidCircle extends Actor implements Entity, Poolable {
if (timer > 0) {
timer -= delta;
} else {
begin = true;
if (currentRadius < endRadius) {
growCurrentRadius(delta*growthRate);
} else {
@ -56,7 +59,9 @@ public class VoidCircle extends Actor implements Entity, Poolable {
@Override
public void draw(Batch batch, float parentAlpha) {
if (timer <= 0) {
batch.end();
shapeRenderer.begin();
if (begin) {
shapeRenderer.set(ShapeType.Filled);
shapeRenderer.setColor(Color.BLACK);
shapeRenderer.circle(getX(), getY(), currentRadius);
@ -64,6 +69,10 @@ public class VoidCircle extends Actor implements Entity, Poolable {
shapeRenderer.set(ShapeType.Line);
shapeRenderer.setColor(Color.RED);
shapeRenderer.circle(getX(), getY(), endRadius);
shapeRenderer.end();
batch.begin();
super.draw(batch, parentAlpha);
}
@ -75,6 +84,7 @@ public class VoidCircle extends Actor implements Entity, Poolable {
timer = 0;
endRadius = 0;
done = false;
begin = false;
}
public void setCurrentRadius(float currentRadius) {

View File

@ -18,11 +18,12 @@ public class CreativeDebugScreen extends ScreenAdapter {
ShapeRenderer shapes;
public CreativeDebugScreen(Polyjet core, MainMenu mainMenu) {
creative = new CreativeStage(core, mainMenu);
gamePlayArea = new GamePlayArea(core.getAssetManager(), shapes);
creative = new CreativeStage(core, mainMenu, gamePlayArea);
shapes = new ShapeRenderer();
shapes.setAutoShapeType(true);
gamePlayArea = new GamePlayArea(core.getAssetManager(), shapes);
inputs = new InputMultiplexer(creative, gamePlayArea);
}
@ -39,10 +40,7 @@ public class CreativeDebugScreen extends ScreenAdapter {
gamePlayArea.getViewport().apply();
gamePlayArea.act();
shapes.begin();
gamePlayArea.draw();
shapes.end();
creative.getViewport().apply();
creative.act();
@ -54,4 +52,10 @@ public class CreativeDebugScreen extends ScreenAdapter {
public void resize(int width, int height) {
super.resize(width, height);
}
@Override
public void dispose() {
shapes.dispose();
super.dispose();
}
}

View File

@ -125,10 +125,7 @@ public class GameScreen extends ScreenAdapter implements InputProcessor {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
gameArea.getViewport().apply();
shapeRenderer.begin();
gameArea.draw();
shapeRenderer.end();
overlay.getViewport().apply();
overlay.draw();

View File

@ -21,6 +21,7 @@ import zero1hd.polyjet.ui.windows.FPSWindow;
import zero1hd.polyjet.ui.windows.GraphWindow;
import zero1hd.polyjet.ui.windows.MusicController;
import zero1hd.polyjet.ui.windows.MusicSelector;
import zero1hd.polyjet.ui.windows.SpawnerWindow;
import zero1hd.polyjet.ui.windows.VolumeWindow;
import zero1hd.polyjet.util.MiniEvents;
import zero1hd.polyjet.util.MiniListener;
@ -29,25 +30,24 @@ public class CreativeStage extends Stage implements MiniListener {
MusicController musicPlayBackControls;
MusicSelector musicSelector;
FPSWindow fpsViewer;
BeatViewer beatViewer;
GraphWindow graphViewer;
VolumeWindow volumeWindow;
SpawnerWindow spawnerWindow;
AudioAnalyzer analyzer;
Window toolbox;
public CreativeStage(final Polyjet core, final MainMenu mainMenu) {
public CreativeStage(final Polyjet core, final MainMenu mainMenu, final GamePlayArea gpa) {
musicSelector = new MusicSelector("Select Audio File", core.getDefaultSkin(), core.getPrefs().getString("music dir"), "default");
musicSelector.miniSender.addListener(this);
musicSelector.refresh();
fpsViewer = new FPSWindow("FPS", core.getDefaultSkin());
beatViewer = new BeatViewer("Beat", core.getDefaultSkin());
graphViewer = new GraphWindow("Peak Values", core.getDefaultSkin());
volumeWindow = new VolumeWindow("Volume adjustments", core.getDefaultSkin(), core.getPrefs());
spawnerWindow = new SpawnerWindow("Spawn Tool", core.getDefaultSkin(), gpa.entityController, gpa);
//Back button
TextButton backButton = new TextButton("Back", core.getDefaultSkin());
@ -148,7 +148,6 @@ public class CreativeStage extends Stage implements MiniListener {
final CheckBox volumeMixerCheckbox = new CheckBox(" Volume", core.getDefaultSkin());
volumeMixerCheckbox.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (volumeMixerCheckbox.isChecked()) {
@ -158,8 +157,22 @@ public class CreativeStage extends Stage implements MiniListener {
}
}
});
toolboxToolSet.add(volumeMixerCheckbox);
toolboxToolSet.row();
final CheckBox spawnToolCheckBox = new CheckBox(" Spawn Tool", core.getDefaultSkin());
spawnToolCheckBox.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (spawnToolCheckBox.isChecked()) {
addActor(spawnerWindow);
} else {
spawnerWindow.remove();
}
}
});
toolboxToolSet.add(spawnToolCheckBox);
ScrollPane scroller = new ScrollPane(toolboxToolSet, core.getDefaultSkin());
toolbox.add(scroller).expand().fill();

View File

@ -19,7 +19,7 @@ import zero1hd.polyjet.entity.ally.PolyJetEntity;
public class GamePlayArea extends Stage {
public PolyJetEntity polyjet;
private EntityController entityController;
public EntityController entityController;
private CollisionDetector collisionDetector;
private float maxHealth = 100;

View File

@ -22,8 +22,12 @@ public class SpawnerWindow extends Window {
super(title, skin);
spawnName = new TextField("", skin);
modifier = new TextField("0;0;0", skin);
add(spawnName, modifier);
this.ec = ec;
stage = stageForEntities;
setWidth(spawnName.getWidth()+modifier.getWidth()+30f);
setHeight(spawnName.getHeight()+35f);
}