added network buttons to the menu and changed som small things
This commit is contained in:
parent
a289d96d6a
commit
a0363aa3d8
7 changed files with 35 additions and 9 deletions
BIN
src/data/ui/host.png
Normal file
BIN
src/data/ui/host.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
src/data/ui/host_ontop.png
Normal file
BIN
src/data/ui/host_ontop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
src/data/ui/join.png
Normal file
BIN
src/data/ui/join.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
src/data/ui/join_ontop.png
Normal file
BIN
src/data/ui/join_ontop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
|
|
@ -32,7 +32,7 @@ public class AStar{
|
|||
}
|
||||
|
||||
public List<AStarNode> startSearch(Vector2i start, Vector2i goal){
|
||||
//map[goal.getX()][goal.getY()].setBlocked(false);
|
||||
//checks that the start and goul are inside the map
|
||||
if(start.getX() >= map.length)
|
||||
start.setX(map.length-1);
|
||||
if(start.getX() < 0)
|
||||
|
|
@ -52,6 +52,8 @@ public class AStar{
|
|||
goal.setY(map[0].length-1);
|
||||
if(goal.getY() < 0)
|
||||
goal.setY(0);
|
||||
|
||||
map[goal.getX()][goal.getY()].setBlocked(false);
|
||||
return pathfinder.findPath(map[start.getX()][start.getY()], map[goal.getX()][goal.getY()]);
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +92,7 @@ public class AStar{
|
|||
|
||||
if(!InGameState.getMap().isPosEmpty(x, y)) {
|
||||
map[x][y].setBlocked(true);
|
||||
MultiPrintStream.out.print(1);
|
||||
MultiPrintStream.out.print(""+1);
|
||||
}
|
||||
else MultiPrintStream.out.print(""+0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ public class MenuState extends GameState implements UiListener{
|
|||
|
||||
private Button resume;
|
||||
private Button newGame;
|
||||
private Button join;
|
||||
private Button host;
|
||||
private Button quit;
|
||||
|
||||
public MenuState(String name){
|
||||
|
|
@ -29,6 +31,7 @@ public class MenuState extends GameState implements UiListener{
|
|||
menuNode = new Node("MenuNode");
|
||||
|
||||
int x = LWJGLGameWindow.getWidth()/2;
|
||||
int y = 250;
|
||||
|
||||
Sprite logo = new Sprite("Logo","data/logo.png");
|
||||
logo.setLocation(new Vector2f(x,100));
|
||||
|
|
@ -41,24 +44,44 @@ public class MenuState extends GameState implements UiListener{
|
|||
resume.setButtonSprite(s1);
|
||||
resume.setOnTopButtonSprite(new Sprite("ResumeButton_Selected","data/ui/resume_ontop.png"));
|
||||
resume.setDisabledButtonSprite(new Sprite("ResumeButton_Disabled","data/ui/resume_disabled.png"));
|
||||
resume.getNode().setLocation(new Vector2f(x,250));
|
||||
resume.getNode().setLocation(new Vector2f(x,y));
|
||||
resume.addListener(this);
|
||||
resume.setEnabled(false);
|
||||
ui.addUi(resume);
|
||||
|
||||
y += 40;
|
||||
Sprite s2 = new Sprite("NewButton","data/ui/new.png");
|
||||
newGame = new Button("New", s2.getSize());
|
||||
newGame.setButtonSprite(s2);
|
||||
newGame.setOnTopButtonSprite(new Sprite("NewButton_Selected","data/ui/new_ontop.png"));
|
||||
newGame.getNode().setLocation(new Vector2f(x,300));
|
||||
newGame.getNode().setLocation(new Vector2f(x,y));
|
||||
newGame.addListener(this);
|
||||
ui.addUi(newGame);
|
||||
|
||||
Sprite s3 = new Sprite("QuitButton","data/ui/quit.png");
|
||||
quit = new Button("Quit", s3.getSize());
|
||||
quit.setButtonSprite(s3);
|
||||
y += 40;
|
||||
Sprite s3 = new Sprite("JoinButton","data/ui/join.png");
|
||||
join = new Button("Join", s3.getSize());
|
||||
join.setButtonSprite(s3);
|
||||
join.setOnTopButtonSprite(new Sprite("JoinButton_Selected","data/ui/join_ontop.png"));
|
||||
join.getNode().setLocation(new Vector2f(x,y));
|
||||
join.addListener(this);
|
||||
ui.addUi(join);
|
||||
|
||||
y += 40;
|
||||
Sprite s4 = new Sprite("HostButton","data/ui/host.png");
|
||||
host = new Button("Host", s4.getSize());
|
||||
host.setButtonSprite(s4);
|
||||
host.setOnTopButtonSprite(new Sprite("HostButton_Selected","data/ui/host_ontop.png"));
|
||||
host.getNode().setLocation(new Vector2f(x,y));
|
||||
host.addListener(this);
|
||||
ui.addUi(host);
|
||||
|
||||
y += 40;
|
||||
Sprite s5 = new Sprite("QuitButton","data/ui/quit.png");
|
||||
quit = new Button("Quit", s5.getSize());
|
||||
quit.setButtonSprite(s5);
|
||||
quit.setOnTopButtonSprite(new Sprite("QuitButton_Selected","data/ui/quit_ontop.png"));
|
||||
quit.getNode().setLocation(new Vector2f(x,350));
|
||||
quit.getNode().setLocation(new Vector2f(x,y));
|
||||
quit.addListener(this);
|
||||
ui.addUi(quit);
|
||||
|
||||
|
|
|
|||
|
|
@ -322,7 +322,8 @@ public abstract class Unit extends GameEntity{
|
|||
setPos(temp.getX(), temp.getY());
|
||||
}
|
||||
else if(!path.isEmpty()){
|
||||
move(false, path.getLast().getX(), path.getLast().getY());
|
||||
//removed because its making problem whit the bomber unit
|
||||
//move(false, path.getLast().getX(), path.getLast().getY());
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue