Added debug variable
This commit is contained in:
parent
0bfc621ade
commit
6873572994
3 changed files with 29 additions and 6 deletions
|
|
@ -7,6 +7,8 @@ import ei.game.gamestate.LoadingState;
|
|||
import ei.game.gamestate.SplashState;
|
||||
|
||||
public class EI extends LWJGLGameWindow{
|
||||
public static final boolean debug = true;
|
||||
|
||||
public static void main(String[] args){
|
||||
new EI();
|
||||
}
|
||||
|
|
@ -16,9 +18,15 @@ public class EI extends LWJGLGameWindow{
|
|||
}
|
||||
|
||||
protected void init(){
|
||||
GameStateManager.getInstance().addState(new InGameState("InGameState"));
|
||||
//GameStateManager.getInstance().addState(new LoadingState("LoadingState","InGameState"));
|
||||
//GameStateManager.getInstance().addState(new SplashState("SplashState","LoadingState"));
|
||||
GameStateManager.getInstance().setActive("InGameState");//SplashState");
|
||||
if(debug){
|
||||
GameStateManager.getInstance().addState(new InGameState("InGameState"));
|
||||
GameStateManager.getInstance().setActive("InGameState");
|
||||
}
|
||||
else{
|
||||
GameStateManager.getInstance().addState(new InGameState("InGameState"));
|
||||
GameStateManager.getInstance().addState(new LoadingState("LoadingState","InGameState"));
|
||||
GameStateManager.getInstance().addState(new SplashState("SplashState","LoadingState"));
|
||||
GameStateManager.getInstance().setActive("SplashState");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
import ei.engine.math.Vector2i;
|
||||
import ei.engine.util.MultiPrintStream;
|
||||
import ei.game.gamestate.InGameState;
|
||||
|
||||
public class AStar{
|
||||
|
|
@ -41,8 +42,21 @@ public class AStar{
|
|||
System.out.println("Initializing map");
|
||||
// Create the map.
|
||||
map = new AStarNode2D[width][hight];
|
||||
for(int y = 0, nodeId = 0; hight > y; y++) {
|
||||
MultiPrintStream.out.println();
|
||||
for(int x = 0; width > x; x++, nodeId++) {
|
||||
map[x][y] = new AStarNode2D(x, y, nodeId);
|
||||
|
||||
if(!InGameState.getMap().isPosEmpty(x, y)) {
|
||||
map[x][y].setBlocked(true);
|
||||
MultiPrintStream.out.print(1);
|
||||
}
|
||||
else MultiPrintStream.out.print(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for(int x = 0, nodeId = 0; width > x; x++) {
|
||||
|
||||
for(int y = 0; hight > y; y++, nodeId++) {
|
||||
map[x][y] = new AStarNode2D(x, y, nodeId);
|
||||
|
||||
|
|
@ -51,6 +65,7 @@ public class AStar{
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Create the neighbours.
|
||||
for(int x = 0; width > x; x++) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class InGameMouseInput extends MouseInput{
|
|||
@Override
|
||||
public void mouseDown(int event,int x, int y) {
|
||||
System.out.println("DOWN("+event+"): "+x+"-"+y);
|
||||
Vector2i pos = map.getPosByPixel(
|
||||
Vector2i pos = Map.getPosByPixel(
|
||||
LWJGLGameWindow.getCamera().getLocation().getX()+x,
|
||||
LWJGLGameWindow.getCamera().getLocation().getY()+y);
|
||||
//selecting unit.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue