added pellet entity as well as minor changes to collision functions

This commit is contained in:
Harrison Deng 2017-06-01 23:41:04 -05:00
parent e6be886888
commit 615789fe81
73 changed files with 40 additions and 23 deletions

BIN
android/assets/1280x720/PolyjetTitle.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
android/assets/1280x720/Tech-Circle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 41 KiB

BIN
android/assets/1280x720/cybercircle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 20 KiB

BIN
android/assets/1280x720/cybercircle3B.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 23 KiB

BIN
android/assets/1280x720/laser.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 155 B

BIN
android/assets/1280x720/pellet.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 177 B

BIN
android/assets/1280x720/polyjet-standard.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 336 B

BIN
android/assets/1280x720/splashlogo.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 11 KiB

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

Before

Width:  |  Height:  |  Size: 96 B

After

Width:  |  Height:  |  Size: 96 B

BIN
android/assets/1280x800/PolyjetTitle.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 10 KiB

BIN
android/assets/1280x800/Tech-Circle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 51 KiB

BIN
android/assets/1280x800/cybercircle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 28 KiB

BIN
android/assets/1280x800/cybercircle3B.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 32 KiB

BIN
android/assets/1280x800/laser.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

After

Width:  |  Height:  |  Size: 173 B

BIN
android/assets/1280x800/pellet.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 204 B

BIN
android/assets/1280x800/polyjet-standard.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 747 B

After

Width:  |  Height:  |  Size: 361 B

BIN
android/assets/1280x800/splashlogo.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 18 KiB

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

Before

Width:  |  Height:  |  Size: 100 B

After

Width:  |  Height:  |  Size: 100 B

BIN
android/assets/1366x768/PolyjetTitle.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

BIN
android/assets/1366x768/Tech-Circle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 48 KiB

BIN
android/assets/1366x768/cybercircle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 26 KiB

BIN
android/assets/1366x768/cybercircle3B.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 31 KiB

BIN
android/assets/1366x768/laser.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 171 B

BIN
android/assets/1366x768/pellet.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

After

Width:  |  Height:  |  Size: 185 B

BIN
android/assets/1366x768/polyjet-standard.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 681 B

After

Width:  |  Height:  |  Size: 347 B

BIN
android/assets/1366x768/splashlogo.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 17 KiB

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

Before

Width:  |  Height:  |  Size: 98 B

After

Width:  |  Height:  |  Size: 98 B

BIN
android/assets/1920x1080/PolyjetTitle.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 12 KiB

BIN
android/assets/1920x1080/Tech-Circle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 74 KiB

BIN
android/assets/1920x1080/cybercircle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 38 KiB

BIN
android/assets/1920x1080/cybercircle3B.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 43 KiB

BIN
android/assets/1920x1080/laser.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 B

After

Width:  |  Height:  |  Size: 242 B

BIN
android/assets/1920x1080/pellet.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 239 B

BIN
android/assets/1920x1080/polyjet-standard.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 990 B

After

Width:  |  Height:  |  Size: 450 B

BIN
android/assets/1920x1080/splashlogo.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 16 KiB

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

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 114 B

BIN
android/assets/1920x1200/PolyjetTitle.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 16 KiB

BIN
android/assets/1920x1200/Tech-Circle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 93 KiB

BIN
android/assets/1920x1200/cybercircle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 52 KiB

BIN
android/assets/1920x1200/cybercircle3B.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 58 KiB

BIN
android/assets/1920x1200/laser.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 297 B

BIN
android/assets/1920x1200/pellet.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 282 B

BIN
android/assets/1920x1200/polyjet-standard.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 592 B

BIN
android/assets/1920x1200/splashlogo.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 30 KiB

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

Before

Width:  |  Height:  |  Size: 122 B

After

Width:  |  Height:  |  Size: 122 B

BIN
android/assets/2560x1440/PolyjetTitle.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 21 KiB

BIN
android/assets/2560x1440/Tech-Circle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 123 KiB

BIN
android/assets/2560x1440/cybercircle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 61 KiB

BIN
android/assets/2560x1440/cybercircle3B.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 68 KiB

BIN
android/assets/2560x1440/laser.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 338 B

BIN
android/assets/2560x1440/pellet.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

After

Width:  |  Height:  |  Size: 337 B

BIN
android/assets/2560x1440/polyjet-standard.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 733 B

BIN
android/assets/2560x1440/splashlogo.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 31 KiB

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

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 139 B

BIN
android/assets/3840x2160/pellet.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
android/assets/800x480/PolyjetTitle.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
android/assets/800x480/Tech-Circle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 24 KiB

BIN
android/assets/800x480/cybercircle1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 11 KiB

BIN
android/assets/800x480/cybercircle3B.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 14 KiB

BIN
android/assets/800x480/laser.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

After

Width:  |  Height:  |  Size: 136 B

BIN
android/assets/800x480/pellet.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

After

Width:  |  Height:  |  Size: 129 B

BIN
android/assets/800x480/polyjet-standard.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

After

Width:  |  Height:  |  Size: 220 B

BIN
android/assets/800x480/splashlogo.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

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

Before

Width:  |  Height:  |  Size: 84 B

After

Width:  |  Height:  |  Size: 84 B

View File

@ -24,6 +24,7 @@ public class CollisionDetector {
fe.collided(se);
se.collided(fe);
break;
}
}
}

View File

@ -96,4 +96,18 @@ public class EntityController {
break;
}
}
public void deathClean() {
for (int i = 0; i < activeAllies.size; i ++) {
if (activeAllies.get(i).isDead()) {
free(activeAllies.get(i));
}
}
for (int i = 0; i < activeEnemies.size; i++) {
if (activeEnemies.get(i).isDead()) {
free(activeEnemies.get(i));
}
}
}
}

View File

@ -60,8 +60,10 @@ public class Laser extends Actor implements Entity, Poolable {
@Override
public void collided(Entity entity) {
if (entity.getEntityType() == Entities.VOID_CIRCLE) {
switch (entity.getEntityType()) {
default:
dead = true;
break;
}
}

View File

@ -1,6 +1,7 @@
package zero1hd.polyjet.entity.ally;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.ParticleEffect;
@ -40,7 +41,7 @@ public class PolyJetEntity extends Actor implements Entity {
public void act(float delta) {
hitbox.setPosition(getX(), getY());
thrust.setPosition(getX()+(getWidth())/2 - 1f/16f, getY()-0.15f);
thrust.setPosition(getX()+(getWidth())/2 - 1f/16f, getY()-0.2f);
thrust.update(delta);
teleportCloak.setPosition(getX() +(getWidth()-1)/2, getY() + (getHeight()-1)/2);
@ -66,6 +67,7 @@ public class PolyJetEntity extends Actor implements Entity {
@Override
public void draw(Batch batch, float parentAlpha) {
thrust.draw(batch);
batch.setColor(Color.BLACK);
batch.draw(polyjet, getX(), getY(), getWidth(), getHeight());
super.draw(batch, parentAlpha);
}

19
core/src/zero1hd/polyjet/entity/enemies/Pellet.java Normal file → Executable file
View File

@ -1,7 +1,9 @@
package zero1hd.polyjet.entity.enemies;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
@ -24,16 +26,19 @@ public class Pellet extends Actor implements Entity, Poolable {
this.texture = texture;
}
public void init(float x, float y, float direction, float rate) {
public void init(float x, float y, float angle, float rate, float colorG) {
setPosition(x, y);
this.direction.setAngle(direction);
rate = 0;
setSize(0.5f, 0.5f);
direction.set(MathUtils.sinDeg(angle), MathUtils.cosDeg(angle));
setSize(0.75f, 0.75f);
hitBox.setSize(getWidth(), getHeight());
this.rate = rate;
setColor(1f, colorG, 0f, 1f);
}
@Override
public void act(float delta) {
moveBy(direction.x*delta*rate, direction.y*delta*rate);
hitBox.setPosition(getX(), getY());
super.act(delta);
if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX()-getWidth() < 0 || getY()-getHeight() < 0) {
@ -43,13 +48,15 @@ public class Pellet extends Actor implements Entity, Poolable {
@Override
public void draw(Batch batch, float parentAlpha) {
batch.setColor(getColor().r, getColor().g, getColor().b, getColor().a);
batch.draw(texture, getX(), getY(), getWidth(), getHeight());
batch.setColor(Color.WHITE);
super.draw(batch, parentAlpha);
}
@Override
public void collided(Entity entity) {
if (entity.getEntityType() == Entities.VOID_CIRCLE) {
if (entity.getEntityType() == Entities.LASER) {
dead = true;
}
}
@ -76,6 +83,8 @@ public class Pellet extends Actor implements Entity, Poolable {
setPosition(0, 0);
direction.set(0,0);
rate = 0;
dead = false;
setColor(1f, 1f, 1f, 1f);
}
}

View File

@ -44,18 +44,7 @@ public class GamePlayArea extends Stage {
@Override
public void act(float delta) {
collisionDetector.collisionCheck();
for (int i = 0; i < entityController.activeAllies.size; i ++) {
if (entityController.activeAllies.get(i).isDead()) {
entityController.free(entityController.activeAllies.get(i));
}
}
for (int i = 0; i < entityController.activeEnemies.size; i++) {
if (entityController.activeEnemies.get(i).isDead()) {
entityController.free(entityController.activeEnemies.get(i));
}
}
entityController.deathClean();
if (polyjet.getX() <= 1) {
polyjet.moveLeft = false;

View File

@ -33,7 +33,7 @@ public class SpawnerWindow extends Window {
stage = stageForEntities;
mod1 = new Slider(0.1f, 50f, 0.01f, true, skin);
mod2 = new Slider(0.1f, 15f, 0.01f, true, skin);
mod2 = new Slider(0f, 15f, 0.01f, true, skin);
mod3 = new Slider(0.1f, 15f, 0.01f, true, skin);
listOfEntities = new List<>(skin);
@ -71,12 +71,12 @@ public class SpawnerWindow extends Window {
break;
case PELLET:
Pellet pellet = (Pellet) entity;
pellet.init(coords.x, coords.y, mod2.getValue(), mod3.getValue());
pellet.init(coords.x, coords.y, mod2.getValue()/mod2.getMaxValue()*360f, mod1.getValue(), mod3.getValue()/mod3.getMaxValue());
stage.addActor(pellet);
break;
case VOID_CIRCLE:
VoidCircle voidCircle = (VoidCircle) entity;
voidCircle.init(mod3.getValue(), coords.x, coords.y, mod1.getValue(), mod2.getValue());
voidCircle.init(mod2.getValue(), coords.x, coords.y, mod1.getValue(), mod3.getValue());
stage.addActor(voidCircle);
break;
default:

View File

@ -12,7 +12,7 @@ public class DesktopLauncher {
config.width = 800;
config.height = 480;
config.resizable = false;
System.setProperty("org.lwjgl.opengl.Window.undecorated", "true");
// System.setProperty("org.lwjgl.opengl.Window.undecorated", "true");
new LwjglApplication(new Polyjet(), config);