fixed flake entity issue with shard entity lagging behind
This commit is contained in:
parent
c33947ef5f
commit
a9443b1acc
@ -41,15 +41,17 @@ public class Flake extends Actor implements Poolable, Entity {
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
|
||||
if (timer > 0) {
|
||||
timer -= delta;
|
||||
}
|
||||
moveBy(rot.x*delta*rate, rot.y*delta*rate);
|
||||
|
||||
System.out.println("START");
|
||||
System.out.println(getY());
|
||||
for (int i = 0; i < shards.length; i++) {
|
||||
shards[i].setPosition(getX()+center.x-shards[i].getCenter().x, getY()+center.y-shards[i].getCenter().y);
|
||||
}
|
||||
System.out.println(shards[0].getY());
|
||||
|
||||
hitbox.setPosition(getX(), getY());
|
||||
|
||||
if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) {
|
||||
|
@ -61,7 +61,6 @@ public class Shard extends Actor implements Entity, Poolable {
|
||||
public void act(float delta) {
|
||||
moveBy(angle.x*delta*rate, angle.y*rate*delta);
|
||||
hitbox.setPosition(getX(), getY());
|
||||
sprite.setCenter(getX()+center.x, getY()+center.y);
|
||||
|
||||
if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) {
|
||||
hp = 0;
|
||||
@ -72,6 +71,8 @@ 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(1f, 0f, (float)hp/(float)maxHp, 1f);
|
||||
sprite.draw(batch);
|
||||
batch.setColor(Color.WHITE);
|
||||
|
@ -95,16 +95,15 @@ public class SpawnerWindow extends Window {
|
||||
stage.addActor(bar);
|
||||
break;
|
||||
case FLAKE:
|
||||
Flake flake = (Flake) entity;
|
||||
Shard[] shards = new Shard[(int) mod4.getValue()];
|
||||
for (int i = 0; i < shards.length; i++) {
|
||||
shards[i] = (Shard) ec.retrieveEntity(Entities.SHARD);
|
||||
shards[i].init(coords.x, coords.y, 360f/shards.length*i, 0f, (int) mod3.getValue());
|
||||
shards[i].init(coords.x, coords.y, 360f/shards.length*i, 0f, (int) 2);
|
||||
stage.addActor(shards[i]);
|
||||
}
|
||||
|
||||
Flake flake = (Flake) entity;
|
||||
flake.init(coords.x, coords.y, mod1.getValue(), mod3.getValue(), mod2.getValue()/mod2.getMaxValue()*360f, shards);
|
||||
stage.addActor(flake);
|
||||
flake.init(coords.x, coords.y, mod1.getValue(), mod3.getValue(), mod2.getValue()/mod2.getMaxValue()*360f, shards);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user