This commit is contained in:
Jesper Lundin 2007-04-24 12:57:38 +00:00
parent 2cf489403d
commit 515281351c
10 changed files with 64 additions and 17 deletions

View file

@ -127,14 +127,29 @@ public class InGameMouseInput extends MouseInput{
//unit action.
else if(event==RIGHT_MOUSE_BUTTON) {
if(!map.isPosEmpty(pos.getX(), pos.getY())){
int rand = (int)(Math.random()*selected.size());
for(int i=0; i<selected.size(); i++) {
selected.get(i).attack(new Vector2i(pos.getX(), pos.getY()));
if(rand==i) {
selected.get(i).attack(new Vector2i(pos.getX(), pos.getY()), true);
}
else{
selected.get(i).attack(new Vector2i(pos.getX(), pos.getY()), false);
}
}
}
else{
//MultiPrintStream.out.println("Moving: "+pos.getX()+", "+pos.getY());
int rand = (int)(Math.random()*selected.size());
for(int i=0; i<selected.size() ;i++){
selected.get(i).move(pos.getX(),pos.getY());
if(rand==i) {
selected.get(i).move(true, pos.getX(),pos.getY());
}
else{
selected.get(i).move(false, pos.getX(),pos.getY());
}
}
}
}