This commit is contained in:
parent
159061194a
commit
59ac3f7883
1 changed files with 12 additions and 1 deletions
|
|
@ -40,6 +40,8 @@ public class InGameMouseInput extends MouseInput{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseUpdate(int x, int y, int w) {
|
public void mouseUpdate(int x, int y, int w) {
|
||||||
|
removeDead();
|
||||||
|
|
||||||
// mov cam to the left
|
// mov cam to the left
|
||||||
if(x < CAMERA_MOVE_BORDER){
|
if(x < CAMERA_MOVE_BORDER){
|
||||||
LWJGLGameWindow.getCamera().getLocation().add(-CAMERA_MOVE_SPEED,0,0);
|
LWJGLGameWindow.getCamera().getLocation().add(-CAMERA_MOVE_SPEED,0,0);
|
||||||
|
|
@ -104,6 +106,7 @@ public class InGameMouseInput extends MouseInput{
|
||||||
Vector2i pos = Map.getPosByPixel(
|
Vector2i pos = Map.getPosByPixel(
|
||||||
LWJGLGameWindow.getCamera().getLocation().getX()+x,
|
LWJGLGameWindow.getCamera().getLocation().getX()+x,
|
||||||
LWJGLGameWindow.getCamera().getLocation().getY()+y);
|
LWJGLGameWindow.getCamera().getLocation().getY()+y);
|
||||||
|
removeDead();
|
||||||
if(map.posExist(pos.getX(), pos.getY())){
|
if(map.posExist(pos.getX(), pos.getY())){
|
||||||
//selecting unit.
|
//selecting unit.
|
||||||
if(event==LEFT_MOUSE_BUTTON){
|
if(event==LEFT_MOUSE_BUTTON){
|
||||||
|
|
@ -138,7 +141,7 @@ public class InGameMouseInput extends MouseInput{
|
||||||
Vector2i pos = Map.getPosByPixel(
|
Vector2i pos = Map.getPosByPixel(
|
||||||
LWJGLGameWindow.getCamera().getLocation().getX()+x,
|
LWJGLGameWindow.getCamera().getLocation().getX()+x,
|
||||||
LWJGLGameWindow.getCamera().getLocation().getY()+y);
|
LWJGLGameWindow.getCamera().getLocation().getY()+y);
|
||||||
|
removeDead();
|
||||||
if(map.posExist(pos.getX(), pos.getY())){
|
if(map.posExist(pos.getX(), pos.getY())){
|
||||||
if(leftKlickPos != null){
|
if(leftKlickPos != null){
|
||||||
deselectAllUnits();
|
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
|
* Selecting all the units between the two positions
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue