minor work on entities and added speed control to polyjet entity
This commit is contained in:
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.ParticleEffect;
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.math.Vector3;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
|
||||
|
||||
@@ -20,10 +21,12 @@ public class PolyJetEntity extends Actor implements Entity {
|
||||
private ParticleEffect teleportCloak;
|
||||
private Rectangle hitbox;
|
||||
|
||||
public boolean moveLeft, moveRight, moveUp, moveDown, teleporting;
|
||||
public boolean moveLeft, moveRight, moveUp, moveDown, teleporting, accelerate;
|
||||
private float speed, accel;
|
||||
private float rate;
|
||||
public PolyJetEntity(AssetManager assets, float rate, String jet) {
|
||||
this.rate = rate;
|
||||
public PolyJetEntity(AssetManager assets, float speed, float accel, String jet) {
|
||||
this.speed = speed;
|
||||
this.accel = accel;
|
||||
setSize(1.5f, 1.5f);
|
||||
setPosition(Polyjet.GAME_AREA_WIDTH/2 - getWidth()/2, -4f);
|
||||
|
||||
@@ -47,6 +50,12 @@ public class PolyJetEntity extends Actor implements Entity {
|
||||
|
||||
|
||||
//Movement!
|
||||
if (accelerate) {
|
||||
rate = speed + accel;
|
||||
} else {
|
||||
rate = speed;
|
||||
}
|
||||
|
||||
if (moveLeft && !moveRight) {
|
||||
moveBy(-(rate*delta), 0);
|
||||
}
|
||||
@@ -60,7 +69,7 @@ public class PolyJetEntity extends Actor implements Entity {
|
||||
if (moveDown && !moveUp) {
|
||||
moveBy(0, -rate*delta);
|
||||
}
|
||||
|
||||
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
|
@@ -56,8 +56,10 @@ public class Pellet extends Actor implements Entity, Poolable {
|
||||
|
||||
@Override
|
||||
public void collided(Entity entity) {
|
||||
if (entity.getEntityType() == Entities.LASER) {
|
||||
switch (entity.getEntityType()) {
|
||||
default:
|
||||
dead = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user