continued work on flake entityy

This commit is contained in:
Harrison Deng 2017-06-04 02:44:33 -05:00
parent b80aca0e29
commit 4ada07bcd4
3 changed files with 19 additions and 1 deletions

View File

@ -6,7 +6,6 @@ import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.ParticleEffect; import com.badlogic.gdx.graphics.g2d.ParticleEffect;
import com.badlogic.gdx.math.Rectangle; 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.Actor;
import com.badlogic.gdx.scenes.scene2d.actions.Actions; import com.badlogic.gdx.scenes.scene2d.actions.Actions;

View File

@ -1,12 +1,14 @@
package zero1hd.polyjet.entity.enemies; package zero1hd.polyjet.entity.enemies;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.utils.Pool.Poolable; import com.badlogic.gdx.utils.Pool.Poolable;
import zero1hd.polyjet.Polyjet;
import zero1hd.polyjet.entity.Entities; import zero1hd.polyjet.entity.Entities;
import zero1hd.polyjet.entity.Entity; import zero1hd.polyjet.entity.Entity;
@ -35,6 +37,7 @@ public class Flake extends Actor implements Poolable, Entity {
hitbox.setSize(getWidth(), getHeight()); hitbox.setSize(getWidth(), getHeight());
center.set(getWidth()/2f, getHeight()/2f); center.set(getWidth()/2f, getHeight()/2f);
rot.set(MathUtils.sinDeg(angle), MathUtils.cosDeg(angle)); rot.set(MathUtils.sinDeg(angle), MathUtils.cosDeg(angle));
debug();
} }
@Override @Override
@ -46,13 +49,24 @@ public class Flake extends Actor implements Poolable, Entity {
} }
for (int i = 0; i < shards.length; i++) { for (int i = 0; i < shards.length; i++) {
shards[i].debug();
shards[i].setPosition(getX()+center.x-shards[i].getCenter().x, getY()+center.y-shards[i].getCenter().y); shards[i].setPosition(getX()+center.x-shards[i].getCenter().x, getY()+center.y-shards[i].getCenter().y);
} }
hitbox.setPosition(getX(), getY()); hitbox.setPosition(getX(), getY());
if (getX() > Polyjet.GAME_AREA_WIDTH || getY() > Polyjet.GAME_AREA_HEIGHT || getX() < 0-getWidth() || getY() < 0-getHeight()) {
timer = 0;
}
super.act(delta); super.act(delta);
} }
@Override
public void draw(Batch batch, float parentAlpha) {
batch.draw(texture, getX(), getY());
super.draw(batch, parentAlpha);
}
@Override @Override
public void collided(Entity entity) { public void collided(Entity entity) {
} }
@ -89,6 +103,7 @@ public class Flake extends Actor implements Poolable, Entity {
setSize(0, 0); setSize(0, 0);
center.set(0, 0); center.set(0, 0);
rot.set(0, 0); rot.set(0, 0);
System.out.println("iscleaned");
} }
} }

View File

@ -97,12 +97,16 @@ public class SpawnerWindow extends Window {
case FLAKE: case FLAKE:
Shard[] shards = new Shard[(int) mod4.getValue()]; Shard[] shards = new Shard[(int) mod4.getValue()];
for (int i = 0; i < shards.length; i++) { 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) mod3.getValue());
stage.addActor(shards[i]); stage.addActor(shards[i]);
} }
System.out.println("test");
Flake flake = (Flake) entity; Flake flake = (Flake) entity;
flake.init(coords.x, coords.y, mod1.getValue(), mod3.getValue(), mod2.getValue()/mod2.getMaxValue()*360f, shards); flake.init(coords.x, coords.y, mod1.getValue(), mod3.getValue(), mod2.getValue()/mod2.getMaxValue()*360f, shards);
stage.addActor(flake);
default: default:
break; break;
} }