fixed minor resize bug on pre game screen and made small design changes to entities

This commit is contained in:
2017-07-12 16:01:13 -05:00
parent 2cd752f25c
commit 44551bdea3
5 changed files with 57 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
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;
@@ -16,6 +17,7 @@ public class Flake extends Actor implements Poolable, Entity {
private Texture texture;
private float rate;
private float timer;
private float totalTime;
private Shard[] shards;
private Rectangle hitbox;
private Vector2 center;
@@ -33,6 +35,7 @@ public class Flake extends Actor implements Poolable, Entity {
setSize(3f, 3f);
this.rate = rate;
this.timer = fuse;
this.totalTime = fuse;
hitbox.setSize(getWidth(), getHeight());
center.set(getWidth()/2f, getHeight()/2f);
setPosition(x-center.x, y-center.y);
@@ -59,12 +62,21 @@ public class Flake extends Actor implements Poolable, Entity {
@Override
public void draw(Batch batch, float parentAlpha) {
batch.setColor(0.25f,0.25f,0.25f,1f- timer/totalTime);
batch.draw(texture, getX(), getY(), getWidth(), getHeight());
batch.setColor(Color.WHITE);
super.draw(batch, parentAlpha);
}
@Override
public void collided(Entity entity) {
switch (entity.getEntityType()) {
case LASER:
timer --;
break;
default:
break;
}
}
@Override
@@ -99,6 +111,7 @@ public class Flake extends Actor implements Poolable, Entity {
setSize(0, 0);
center.set(0, 0);
rot.set(0, 0);
totalTime = 0;
}
}

View File

@@ -71,7 +71,7 @@ public class Shard extends Actor implements Entity, Poolable {
@Override
public void draw(Batch batch, float parentAlpha) {
sprite.setCenter(getX()+center.x, getY()+center.y);
sprite.setColor(1.3f-((float)hp/(float)maxHp), 1.3f-((float)hp/(float)maxHp), 1.3f-((float)hp/(float)maxHp), 0.75f);
sprite.setColor(((float)hp/(float)maxHp), ((float)hp/(float)maxHp), ((float)hp/(float)maxHp), 0.5f);
sprite.draw(batch);
batch.setColor(Color.WHITE);
super.draw(batch, parentAlpha);