Fixed with nodes and selection

This commit is contained in:
Jesper Lundin 2007-04-16 11:34:57 +00:00
parent c1e3fcdf9e
commit 1cb10a3166
5 changed files with 75 additions and 29 deletions

View file

@ -55,13 +55,19 @@ public class InGameMouseInput extends MouseInput{
Vector2i pos = map.getPosByPixel(
LWJGLGameWindow.getCamera().getLocation().getX()+x,
LWJGLGameWindow.getCamera().getLocation().getY()+y);
//selecting unit.
if(!map.isPosEmpty(pos.getX(), pos.getY())){
//map.printAllUnits();
for(int i=0; i<selected.size(); i++) {
selected.get(i).setSelected(false);
}
selected.clear();
MultiPrintStream.out.println("Selecting: "+pos.getX()+", "+pos.getY());
selected.add(map.getPos(pos.getX(), pos.getY()));
map.getPos(pos.getX(), pos.getY()).setSelected(true);
}
else{
else{ //unit action.
MultiPrintStream.out.println("Moving: "+pos.getX()+", "+pos.getY());
for(int i=0; i<selected.size() ;i++){
selected.get(i).move(pos.getX(),pos.getY());