Merge branch 'master' of /home/ydeng/git/Polyjet
BIN
android/assets/1280x720/PolyjetTitle.png
Executable file → Normal file
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 3.0 KiB |
BIN
android/assets/1280x720/Tech-Circle1.png
Executable file → Normal file
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 31 KiB |
BIN
android/assets/1280x720/cybercircle1.png
Executable file → Normal file
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 16 KiB |
BIN
android/assets/1280x720/cybercircle3B.png
Executable file → Normal file
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 18 KiB |
BIN
android/assets/1280x720/laser.png
Executable file → Normal file
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 141 B |
BIN
android/assets/1280x720/pellet.png
Normal file
After Width: | Height: | Size: 126 B |
BIN
android/assets/1280x720/polyjet-standard.png
Executable file → Normal file
Before Width: | Height: | Size: 679 B After Width: | Height: | Size: 619 B |
BIN
android/assets/1280x720/splashlogo.png
Executable file → Normal file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 6.7 KiB |
0
android/assets/1280x720/square.png
Executable file → Normal file
Before Width: | Height: | Size: 96 B After Width: | Height: | Size: 96 B |
BIN
android/assets/1280x800/PolyjetTitle.png
Executable file → Normal file
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 3.6 KiB |
BIN
android/assets/1280x800/Tech-Circle1.png
Executable file → Normal file
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 37 KiB |
BIN
android/assets/1280x800/cybercircle1.png
Executable file → Normal file
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 17 KiB |
BIN
android/assets/1280x800/cybercircle3B.png
Executable file → Normal file
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 19 KiB |
BIN
android/assets/1280x800/laser.png
Executable file → Normal file
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 146 B |
BIN
android/assets/1280x800/pellet.png
Normal file
After Width: | Height: | Size: 147 B |
BIN
android/assets/1280x800/polyjet-standard.png
Executable file → Normal file
Before Width: | Height: | Size: 771 B After Width: | Height: | Size: 747 B |
BIN
android/assets/1280x800/splashlogo.png
Executable file → Normal file
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 8.2 KiB |
0
android/assets/1280x800/square.png
Executable file → Normal file
Before Width: | Height: | Size: 100 B After Width: | Height: | Size: 100 B |
BIN
android/assets/1366x768/PolyjetTitle.png
Executable file → Normal file
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 3.4 KiB |
BIN
android/assets/1366x768/Tech-Circle1.png
Executable file → Normal file
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 35 KiB |
BIN
android/assets/1366x768/cybercircle1.png
Executable file → Normal file
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 17 KiB |
BIN
android/assets/1366x768/cybercircle3B.png
Executable file → Normal file
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 19 KiB |
BIN
android/assets/1366x768/laser.png
Executable file → Normal file
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 156 B |
BIN
android/assets/1366x768/pellet.png
Normal file
After Width: | Height: | Size: 92 B |
BIN
android/assets/1366x768/polyjet-standard.png
Executable file → Normal file
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 681 B |
BIN
android/assets/1366x768/splashlogo.png
Executable file → Normal file
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 7.4 KiB |
0
android/assets/1366x768/square.png
Executable file → Normal file
Before Width: | Height: | Size: 98 B After Width: | Height: | Size: 98 B |
BIN
android/assets/1920x1080/PolyjetTitle.png
Executable file → Normal file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 5.7 KiB |
BIN
android/assets/1920x1080/Tech-Circle1.png
Executable file → Normal file
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 63 KiB |
BIN
android/assets/1920x1080/cybercircle1.png
Executable file → Normal file
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 30 KiB |
BIN
android/assets/1920x1080/cybercircle3B.png
Executable file → Normal file
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 33 KiB |
BIN
android/assets/1920x1080/laser.png
Executable file → Normal file
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 215 B |
BIN
android/assets/1920x1080/pellet.png
Normal file
After Width: | Height: | Size: 132 B |
BIN
android/assets/1920x1080/polyjet-standard.png
Executable file → Normal file
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 990 B |
BIN
android/assets/1920x1080/splashlogo.png
Executable file → Normal file
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 13 KiB |
0
android/assets/1920x1080/square.png
Executable file → Normal file
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 114 B |
BIN
android/assets/1920x1200/PolyjetTitle.png
Executable file → Normal file
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 6.6 KiB |
BIN
android/assets/1920x1200/Tech-Circle1.png
Executable file → Normal file
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 76 KiB |
BIN
android/assets/1920x1200/cybercircle1.png
Executable file → Normal file
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 25 KiB |
BIN
android/assets/1920x1200/cybercircle3B.png
Executable file → Normal file
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 27 KiB |
BIN
android/assets/1920x1200/laser.png
Executable file → Normal file
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 237 B |
BIN
android/assets/1920x1200/pellet.png
Normal file
After Width: | Height: | Size: 174 B |
BIN
android/assets/1920x1200/polyjet-standard.png
Executable file → Normal file
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
android/assets/1920x1200/splashlogo.png
Executable file → Normal file
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 16 KiB |
0
android/assets/1920x1200/square.png
Executable file → Normal file
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 122 B |
BIN
android/assets/2560x1440/PolyjetTitle.png
Executable file → Normal file
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 9.0 KiB |
BIN
android/assets/2560x1440/Tech-Circle1.png
Executable file → Normal file
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 106 KiB |
BIN
android/assets/2560x1440/cybercircle1.png
Executable file → Normal file
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 44 KiB |
BIN
android/assets/2560x1440/cybercircle3B.png
Executable file → Normal file
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 49 KiB |
BIN
android/assets/2560x1440/laser.png
Executable file → Normal file
Before Width: | Height: | Size: 338 B After Width: | Height: | Size: 285 B |
BIN
android/assets/2560x1440/pellet.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
android/assets/2560x1440/polyjet-standard.png
Executable file → Normal file
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
android/assets/2560x1440/splashlogo.png
Executable file → Normal file
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 22 KiB |
0
android/assets/2560x1440/square.png
Executable file → Normal file
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 139 B |
BIN
android/assets/3840x2160/pellet.png
Normal file
After Width: | Height: | Size: 533 B |
BIN
android/assets/800x480/PolyjetTitle.png
Executable file → Normal file
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 1.7 KiB |
BIN
android/assets/800x480/Tech-Circle1.png
Executable file → Normal file
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 15 KiB |
BIN
android/assets/800x480/cybercircle1.png
Executable file → Normal file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 4.8 KiB |
BIN
android/assets/800x480/cybercircle3B.png
Executable file → Normal file
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 5.5 KiB |
BIN
android/assets/800x480/laser.png
Executable file → Normal file
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 99 B |
BIN
android/assets/800x480/pellet.png
Normal file
After Width: | Height: | Size: 95 B |
BIN
android/assets/800x480/polyjet-standard.png
Executable file → Normal file
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 373 B |
BIN
android/assets/800x480/splashlogo.png
Executable file → Normal file
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 3.6 KiB |
0
android/assets/800x480/square.png
Executable file → Normal file
Before Width: | Height: | Size: 84 B After Width: | Height: | Size: 84 B |
@ -124,6 +124,7 @@ public class Polyjet extends Game {
|
||||
assetManager.load("pop_open.ogg", Sound.class);
|
||||
assetManager.load("pop_close.ogg", Sound.class);
|
||||
assetManager.load("laser.png", Texture.class);
|
||||
assetManager.load("pellet.png", Texture.class);
|
||||
}
|
||||
public void generateFonts() {
|
||||
initComplete = true;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package zero1hd.polyjet.entity;
|
||||
|
||||
public enum Entities {
|
||||
POLYJET, BAR_BEAT, VOID_CIRCLE, SHARDS, LASER;
|
||||
POLYJET, BAR_BEAT, VOID_CIRCLE, SHARDS, LASER, PELLET;
|
||||
|
||||
public float x;
|
||||
public float y;
|
||||
|
@ -7,6 +7,7 @@ import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Pool;
|
||||
|
||||
import zero1hd.polyjet.entity.ally.Laser;
|
||||
import zero1hd.polyjet.entity.enemies.Pellet;
|
||||
import zero1hd.polyjet.entity.enemies.VoidCircle;
|
||||
|
||||
public class EntityController {
|
||||
@ -17,6 +18,7 @@ public class EntityController {
|
||||
public Array<Entity> activeEnemies;
|
||||
//Enemy pool declaration;
|
||||
private Pool<VoidCircle> voidCirclePool;
|
||||
private Pool<Pellet> pelletPool;
|
||||
|
||||
//Ally pool declaration;
|
||||
private Pool<Laser> laserPool;
|
||||
@ -35,6 +37,12 @@ public class EntityController {
|
||||
return new VoidCircle(shapes);
|
||||
}
|
||||
};
|
||||
pelletPool = new Pool<Pellet>() {
|
||||
@Override
|
||||
protected Pellet newObject() {
|
||||
return new Pellet(assets.get("pellet.png", Texture.class));
|
||||
}
|
||||
};
|
||||
|
||||
//Ally pool initialization;
|
||||
laserPool = new Pool<Laser>() {
|
||||
@ -52,14 +60,14 @@ public class EntityController {
|
||||
VoidCircle voidCircle = voidCirclePool.obtain();
|
||||
activeEnemies.add(voidCircle);
|
||||
return voidCircle;
|
||||
case BAR_BEAT:
|
||||
return null;
|
||||
case SHARDS:
|
||||
return null;
|
||||
case LASER:
|
||||
Laser laser = laserPool.obtain();
|
||||
activeAllies.add(laser);
|
||||
return laser;
|
||||
case PELLET:
|
||||
Pellet pellet = pelletPool.obtain();
|
||||
activeEnemies.add(pellet);
|
||||
return pellet;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@ -67,10 +75,6 @@ public class EntityController {
|
||||
|
||||
public void free(Entity entity) {
|
||||
switch (entity.getEntityType()) {
|
||||
case BAR_BEAT:
|
||||
break;
|
||||
case SHARDS:
|
||||
break;
|
||||
case VOID_CIRCLE:
|
||||
VoidCircle voidCircle = (VoidCircle) entity;
|
||||
voidCircle.remove();
|
||||
@ -83,6 +87,11 @@ public class EntityController {
|
||||
activeAllies.removeValue(entity, true);
|
||||
laserPool.free(laser);
|
||||
break;
|
||||
case PELLET:
|
||||
Pellet pellet = (Pellet) entity;
|
||||
pellet.remove();
|
||||
activeEnemies.removeValue(entity, true);
|
||||
pelletPool.free(pellet);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
81
core/src/zero1hd/polyjet/entity/enemies/Pellet.java
Normal file
@ -0,0 +1,81 @@
|
||||
package zero1hd.polyjet.entity.enemies;
|
||||
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||
|
||||
import zero1hd.polyjet.Polyjet;
|
||||
import zero1hd.polyjet.entity.Entities;
|
||||
import zero1hd.polyjet.entity.Entity;
|
||||
|
||||
public class Pellet extends Actor implements Entity, Poolable {
|
||||
private boolean dead;
|
||||
private Texture texture;
|
||||
private Rectangle hitBox;
|
||||
private Vector2 direction;
|
||||
private float rate;
|
||||
|
||||
public Pellet(Texture texture) {
|
||||
hitBox = new Rectangle();
|
||||
direction = new Vector2();
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public void init(float x, float y, float direction, float rate) {
|
||||
setPosition(x, y);
|
||||
this.direction.setAngle(direction);
|
||||
rate = 0;
|
||||
setSize(0.5f, 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
moveBy(direction.x*delta*rate, direction.y*delta*rate);
|
||||
super.act(delta);
|
||||
|
||||
if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX()-getWidth() < 0 || getY()-getHeight() < 0) {
|
||||
dead = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
batch.draw(texture, getX(), getY(), getWidth(), getHeight());
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
if (entity.getEntityType() == Entities.VOID_CIRCLE) {
|
||||
dead = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle getHitZone() {
|
||||
return hitBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entities getEntityType() {
|
||||
return Entities.PELLET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDead() {
|
||||
return dead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
hitBox.set(0, 0, 0, 0);
|
||||
setSize(0, 0);
|
||||
setPosition(0, 0);
|
||||
direction.set(0,0);
|
||||
rate = 0;
|
||||
}
|
||||
|
||||
}
|
@ -14,6 +14,7 @@ import zero1hd.polyjet.entity.Entities;
|
||||
import zero1hd.polyjet.entity.Entity;
|
||||
import zero1hd.polyjet.entity.EntityController;
|
||||
import zero1hd.polyjet.entity.ally.Laser;
|
||||
import zero1hd.polyjet.entity.enemies.Pellet;
|
||||
import zero1hd.polyjet.entity.enemies.VoidCircle;
|
||||
|
||||
public class SpawnerWindow extends Window {
|
||||
@ -68,7 +69,10 @@ public class SpawnerWindow extends Window {
|
||||
laser.init(coords.x, coords.y, mod1.getValue());
|
||||
stage.addActor(laser);
|
||||
break;
|
||||
case SHARDS:
|
||||
case PELLET:
|
||||
Pellet pellet = (Pellet) entity;
|
||||
pellet.init(coords.x, coords.y, mod2.getValue(), mod3.getValue());
|
||||
stage.addActor(pellet);
|
||||
break;
|
||||
case VOID_CIRCLE:
|
||||
VoidCircle voidCircle = (VoidCircle) entity;
|
||||
|