Added a Factory
This commit is contained in:
parent
ae32a0a298
commit
f675011503
5 changed files with 44 additions and 1 deletions
BIN
src/data/map/fabrik/fabrik1.png
Normal file
BIN
src/data/map/fabrik/fabrik1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 217 KiB |
BIN
src/data/map/fabrik/fabrik2.png
Normal file
BIN
src/data/map/fabrik/fabrik2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 280 KiB |
|
|
@ -15,6 +15,7 @@ import ei.engine.util.MultiPrintStream;
|
|||
import ei.game.player.GaiaPlayer;
|
||||
import ei.game.player.Player;
|
||||
import ei.game.player.PlayerHandler;
|
||||
import ei.game.scene.map.Factory;
|
||||
import ei.game.scene.map.Stone;
|
||||
|
||||
public class Map {
|
||||
|
|
@ -24,6 +25,7 @@ public class Map {
|
|||
public static final int MAP_ASFALT = 3;
|
||||
|
||||
public static final int OBJ_STONE = 1;
|
||||
public static final int OBJ_FACTORY = 2;
|
||||
|
||||
public static final int POS_SIZE = 50;
|
||||
private int width;
|
||||
|
|
@ -112,6 +114,9 @@ public class Map {
|
|||
case OBJ_STONE:
|
||||
gaia.addUnit(new Stone(new Vector2i(i,j),gaia));
|
||||
break;
|
||||
case OBJ_FACTORY:
|
||||
gaia.addUnit(new Factory(new Vector2i(i,j),gaia));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
38
src/ei/game/scene/map/Factory.java
Normal file
38
src/ei/game/scene/map/Factory.java
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package ei.game.scene.map;
|
||||
|
||||
import ei.engine.math.Vector2f;
|
||||
import ei.engine.math.Vector2i;
|
||||
import ei.engine.scene.Entity;
|
||||
import ei.engine.scene.Sprite;
|
||||
import ei.game.player.Player;
|
||||
|
||||
public class Factory extends MapEntity{
|
||||
private static final String[] img = {
|
||||
"data/map/factory/factory1.png",
|
||||
"data/map/factory/factory2.png"
|
||||
};
|
||||
|
||||
private Sprite factory;
|
||||
|
||||
public Factory(Vector2i pos, Player p) {
|
||||
super(500, pos, p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
factory = new Sprite("Factory",img[(int)(Math.random()*img.length)]);
|
||||
factory.setSize(new Vector2f(50,50));
|
||||
getNode().add(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getSprite() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaintenanceCost() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ public class Stone extends MapEntity{
|
|||
private Sprite stone;
|
||||
|
||||
public Stone(Vector2i pos, Player p) {
|
||||
super(10000, pos, p);
|
||||
super(500, pos, p);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue