This is a big commit. Added mouse cursors and a load bar. Started whit the game. and many many other things
This commit is contained in:
parent
448fca2fdf
commit
4e7722fedb
34 changed files with 597 additions and 95 deletions
26
src/ei/game/scene/GameEntity.java
Normal file
26
src/ei/game/scene/GameEntity.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package ei.game.scene;
|
||||
|
||||
public abstract class GameEntity{
|
||||
private int life;
|
||||
|
||||
public GameEntity(int l){
|
||||
life = l;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the life
|
||||
*
|
||||
* @return The life
|
||||
*/
|
||||
public int getLife(){
|
||||
return life;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the life
|
||||
* @param l The life to set to
|
||||
*/
|
||||
public void setLife(int l){
|
||||
life = l;
|
||||
}
|
||||
}
|
||||
92
src/ei/game/scene/Map.java
Normal file
92
src/ei/game/scene/Map.java
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
package ei.game.scene;
|
||||
|
||||
import ei.engine.math.Vector3f;
|
||||
import ei.engine.scene.Node;
|
||||
import ei.engine.scene.Sprite;
|
||||
|
||||
public class Map {
|
||||
private static final int POS_SIZE = 50;
|
||||
private int width;
|
||||
private int hight;
|
||||
private GameEntity[][] map;
|
||||
private Node mapNode;
|
||||
|
||||
public Map(int w, int h){
|
||||
this.width = w;
|
||||
this.hight = h;
|
||||
init();
|
||||
}
|
||||
|
||||
private void init(){
|
||||
map = new GameEntity[width][hight];
|
||||
|
||||
// init textures
|
||||
mapNode = new Node("MapNode");
|
||||
for(int i=0; i<width ;i++){
|
||||
for(int j=0; j<hight ;j++){
|
||||
Sprite s = new Sprite("MapPos("+i+","+j+")","data/map/sand.jpg");
|
||||
s.setLocation(new Vector3f(i*POS_SIZE,j*POS_SIZE,0));
|
||||
s.getTexture().setTextureWidth(POS_SIZE+1.2f);
|
||||
s.getTexture().setTextureHeight(POS_SIZE+1.2f);
|
||||
s.getTexture().setWidth(POS_SIZE+1);
|
||||
s.getTexture().setHeight(POS_SIZE+1);
|
||||
mapNode.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the pos inthe map is empty
|
||||
*
|
||||
* @param x The x pos
|
||||
* @param y The y pos
|
||||
* @return True if empty else false
|
||||
*/
|
||||
public boolean isPosEmpty(int x, int y){
|
||||
if(map[x][y] != null){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the object at the pos
|
||||
*
|
||||
* @param x The x pos
|
||||
* @param y The y pos
|
||||
* @return The object in that pos
|
||||
*/
|
||||
public GameEntity getPos(int x, int y){
|
||||
return map[x][y];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an object at the pos
|
||||
*
|
||||
* @param e The object
|
||||
* @param x The x pos
|
||||
* @param y The y pos
|
||||
*/
|
||||
public void setPos(GameEntity e, int x, int y){
|
||||
map[x][y] = e;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a object from that pos
|
||||
*
|
||||
* @param x The x pos
|
||||
* @param y The y pos
|
||||
*/
|
||||
public void removePos(int x, int y){
|
||||
map[x][y] = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the map node
|
||||
*
|
||||
* @return The map node
|
||||
*/
|
||||
public Node getMapNode(){
|
||||
return mapNode;
|
||||
}
|
||||
}
|
||||
17
src/ei/game/scene/buildings/Building.java
Normal file
17
src/ei/game/scene/buildings/Building.java
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package ei.game.scene.buildings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ei.game.scene.GameEntity;
|
||||
import ei.game.scene.units.Unit;
|
||||
|
||||
public abstract class Building extends GameEntity{
|
||||
private ArrayList<Unit> availableUnits;
|
||||
private ArrayList<Unit> buildQueue;
|
||||
|
||||
public Building(int l) {
|
||||
super(l);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
||||
12
src/ei/game/scene/units/Unit.java
Normal file
12
src/ei/game/scene/units/Unit.java
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package ei.game.scene.units;
|
||||
|
||||
import ei.game.scene.GameEntity;
|
||||
|
||||
public abstract class Unit extends GameEntity{
|
||||
|
||||
public Unit(int l) {
|
||||
super(l);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
||||
5
src/ei/game/scene/weapons/Weapon.java
Normal file
5
src/ei/game/scene/weapons/Weapon.java
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
package ei.game.scene.weapons;
|
||||
|
||||
public abstract class Weapon {
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue