This commit is contained in:
Ziver Koc 2007-04-18 16:58:34 +00:00
parent 159061194a
commit 59ac3f7883

View file

@ -40,6 +40,8 @@ public class InGameMouseInput extends MouseInput{
@Override
public void mouseUpdate(int x, int y, int w) {
removeDead();
// mov cam to the left
if(x < CAMERA_MOVE_BORDER){
LWJGLGameWindow.getCamera().getLocation().add(-CAMERA_MOVE_SPEED,0,0);
@ -104,6 +106,7 @@ public class InGameMouseInput extends MouseInput{
Vector2i pos = Map.getPosByPixel(
LWJGLGameWindow.getCamera().getLocation().getX()+x,
LWJGLGameWindow.getCamera().getLocation().getY()+y);
removeDead();
if(map.posExist(pos.getX(), pos.getY())){
//selecting unit.
if(event==LEFT_MOUSE_BUTTON){
@ -138,7 +141,7 @@ public class InGameMouseInput extends MouseInput{
Vector2i pos = Map.getPosByPixel(
LWJGLGameWindow.getCamera().getLocation().getX()+x,
LWJGLGameWindow.getCamera().getLocation().getY()+y);
removeDead();
if(map.posExist(pos.getX(), pos.getY())){
if(leftKlickPos != null){
deselectAllUnits();
@ -149,6 +152,14 @@ public class InGameMouseInput extends MouseInput{
}
}
public void removeDead(){
for(int i=0; i<selected.size() ;i++){
if(selected.get(i).getLife() <= 0){
selected.remove(i);
}
}
}
/**
* Selecting all the units between the two positions
*