added asfalt
This commit is contained in:
parent
586b70a9ba
commit
b5ab445967
6 changed files with 20 additions and 3 deletions
BIN
src/data/map/asfalt.png
Normal file
BIN
src/data/map/asfalt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
|
|
@ -66,6 +66,8 @@ public class ProgressBar{
|
||||||
* @param v The value of the health bar
|
* @param v The value of the health bar
|
||||||
*/
|
*/
|
||||||
public void setValue(int v){
|
public void setValue(int v){
|
||||||
|
if(v < 0)v = 0;
|
||||||
|
if(v > max)v = max;
|
||||||
value.setSize(new Vector2f(((float)v/max)*width,height));//(v/max)*width
|
value.setSize(new Vector2f(((float)v/max)*width,height));//(v/max)*width
|
||||||
value.setLocation(new Vector2f(-width/2+(((float)v/max)*width)/2,0));
|
value.setLocation(new Vector2f(-width/2+(((float)v/max)*width)/2,0));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,14 @@ public abstract class GameState {
|
||||||
private Camera cam;
|
private Camera cam;
|
||||||
|
|
||||||
public GameState(String name){
|
public GameState(String name){
|
||||||
|
this(name, new Camera());
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameState(String name, Camera c){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
input = new InputHandler();
|
input = new InputHandler();
|
||||||
init = false;
|
init = false;
|
||||||
cam = new Camera();
|
cam = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ public class EndGameState extends GameState{
|
||||||
|
|
||||||
|
|
||||||
public EndGameState(String name, int status){
|
public EndGameState(String name, int status){
|
||||||
super(name);
|
super(name,LWJGLGameWindow.getCamera());
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ public class PlayerHandler {
|
||||||
private static final int fundsDelay = 60*30;
|
private static final int fundsDelay = 60*30;
|
||||||
private static final int funds = 1000;
|
private static final int funds = 1000;
|
||||||
private int fundsTimmer;
|
private int fundsTimmer;
|
||||||
|
private Player gaia;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a PlayerHandler
|
* Creates a PlayerHandler
|
||||||
|
|
@ -96,6 +97,7 @@ public class PlayerHandler {
|
||||||
players.get(i).update();
|
players.get(i).update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(gaia != null)gaia.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -115,4 +117,8 @@ public class PlayerHandler {
|
||||||
playerNode.clear();
|
playerNode.clear();
|
||||||
fundsTimmer = 0;
|
fundsTimmer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setGaiaPlayer(Player p){
|
||||||
|
gaia = p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ public class Map {
|
||||||
public static final int MAP_GRASS = 0;
|
public static final int MAP_GRASS = 0;
|
||||||
public static final int MAP_SAND = 1;
|
public static final int MAP_SAND = 1;
|
||||||
public static final int MAP_REDMUD = 2;
|
public static final int MAP_REDMUD = 2;
|
||||||
|
public static final int MAP_ASFALT = 3;
|
||||||
|
|
||||||
public static final int OBJ_STONE = 1;
|
public static final int OBJ_STONE = 1;
|
||||||
|
|
||||||
|
|
@ -95,13 +96,16 @@ public class Map {
|
||||||
case MAP_REDMUD:
|
case MAP_REDMUD:
|
||||||
mapNode.add(getPosSprite(i,j,"data/map/redmud.jpg"));
|
mapNode.add(getPosSprite(i,j,"data/map/redmud.jpg"));
|
||||||
break;
|
break;
|
||||||
|
case MAP_ASFALT:
|
||||||
|
mapNode.add(getPosSprite(i,j,"data/map/redmud.jpg"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// init the gaia player and stones etc...
|
// init the gaia player and stones etc...
|
||||||
Player gaia = new GaiaPlayer();
|
Player gaia = new GaiaPlayer();
|
||||||
PlayerHandler.getInstance().addPlayer(gaia);
|
PlayerHandler.getInstance().setGaiaPlayer(gaia);
|
||||||
for(int i=0; i<width ;i++){
|
for(int i=0; i<width ;i++){
|
||||||
for(int j=0; j<hight ;j++){
|
for(int j=0; j<hight ;j++){
|
||||||
switch(objData[i][j]){
|
switch(objData[i][j]){
|
||||||
|
|
@ -194,6 +198,7 @@ public class Map {
|
||||||
float yf = (POS_SIZE*y);
|
float yf = (POS_SIZE*y);
|
||||||
return new Vector2f(xf,yf);
|
return new Vector2f(xf,yf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector2f getPixelByPos(int x, int y, int size){
|
public static Vector2f getPixelByPos(int x, int y, int size){
|
||||||
if(size%2!=0) {
|
if(size%2!=0) {
|
||||||
size = (size/2)+1;
|
size = (size/2)+1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue