fixed factory
This commit is contained in:
parent
4bf2b2c108
commit
9138ec8402
5 changed files with 44 additions and 9 deletions
|
|
@ -5,24 +5,26 @@ import ei.engine.math.Vector2i;
|
|||
import ei.engine.scene.Entity;
|
||||
import ei.engine.scene.Sprite;
|
||||
import ei.game.player.Player;
|
||||
import ei.game.scene.SelectBox;
|
||||
import ei.game.scene.buildings.Building;
|
||||
import ei.game.scene.weapons.Explotion;
|
||||
import ei.game.scene.weapons.WeaponHandler;
|
||||
|
||||
public class Factory extends MapEntity{
|
||||
public class Factory extends Building{
|
||||
private static final String[] img = {
|
||||
"data/map/factory/factory_1.png",
|
||||
"data/map/factory/factory_2.png"
|
||||
};
|
||||
|
||||
private SelectBox selectionBox;
|
||||
private Sprite factory;
|
||||
|
||||
public Factory(Vector2i pos, Player p) {
|
||||
super(500, pos, p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super(500, pos, p, 4);
|
||||
factory = new Sprite("Factory",img[(int)(Math.random()*img.length)]);
|
||||
factory.setSize(new Vector2f(50,50));
|
||||
factory.setSize(new Vector2f(200,200));
|
||||
getNode().add(factory);
|
||||
|
||||
selectionBox = new SelectBox(0,200,200,getMaxLife());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -33,6 +35,26 @@ public class Factory extends MapEntity{
|
|||
@Override
|
||||
public int getMaintenanceCost() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getGroundSprite() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(Vector2i target, boolean play) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyed() {
|
||||
WeaponHandler.getInstance().addWeapon(new Explotion(new Vector2f(getNode().getLocation().getX(), getNode().getLocation().getY())));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SelectBox getSelection() {
|
||||
return selectionBox;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue