[solved] Selecting a boolean multiple times.

Yeah, matheus23 is spot on.

In English, what you are trying to do is just make sure one position on the map is selected at a time. So, in the code, you’ll want to clear all selections when the user clicks. Then you want to make sure only one position is selected. You are using a field of buttons for each one, so when the user selects a tower button. Clear out all the stores first, and then make sure only one is selected.

That example code was showing you the best places to do it. The [icode] oneOnly[mousex][mousey] = true [/icode] loosely translates to your code in this [icode] public void click(int mouseButton) { … } [/icode].

The first one I already knew, cause he didnt made a void, but still posted it without a reason, sometimes I’m kinda useless and ctomni231, I’m going to try that. cause the problem of my code is the else statement with the if

}else if(!Screen.room.block[y][x].contains(Screen.mse)){

this giving me alot of problems but I am trying your idea, I will send how it went.

[edit]
I did it alot more easier, and fixed it. I’m a little bit brainless that I didn’t thaught of this:

                      if(Screen.room.block[y][x].airID >= 2 && Screen.room.block[y][x].airID <= 7){UpgradeScreen = Screen.room.block[y][x].airID -1; upgradeStore = true;}else{upgradeStore = false; UpgradeScreen =0;}
	public void click(int mouseButton) {
		if(mouseButton == 3) {
			for(int y = 0; y<Screen.room.block.length;y++) {
				for(int x = 0; x<Screen.room.block[0].length;x++) {
					if(!Screen.room.block[y][x].contains(Screen.mse)){
	                   Screen.room.block[y][x].rangeVisible = false;
	                   upgradeStore = false;
	                }
				}
			}
		}
		if(mouseButton == 1) {   
			for(int y = 0; y<Screen.room.block.length;y++) {
				for(int x = 0; x<Screen.room.block[0].length;x++) {
					if(Screen.room.block[y][x].contains(Screen.mse)){
	                  Screen.room.block[y][x].rangeVisible = true;
                          if(Screen.room.block[y][x].airID >= 2 && Screen.room.block[y][x].airID <= 7){UpgradeScreen = Screen.room.block[y][x].airID -1; upgradeStore = true;}else{upgradeStore = false; UpgradeScreen =0;}
					}else{
	                  Screen.room.block[y][x].rangeVisible = false;
					}
				}
			}
			for(int i=0;i<button.length;i++) {
				if(button[i].contains(Screen.mse)) {
					if(store == true){
						if(buttonID[i] != Value.airAir) {
							if(buttonID[i] == Value.airTrashCan) { 
								holdsItem = false;
							} else {
								heldID = buttonID[i];
								realID = i;
								holdsItem = true;
							}
						}
					}
				}
	            
				if(holdsItem) {
	            	if(Screen.money >= buttonPrice[realID]) {
	            		for(int y = 0; y<Screen.room.block.length;y++) {
	            			for(int x = 0; x<Screen.room.block[0].length;x++) {
	            				if(Screen.room.block[y][x].contains(Screen.mse)){
	            					if(Screen.room.block[y][x].groundID != Value.groundGrass | Screen.room.block[y][x].airID != Value.airAir) {holdsItem = false;}
	            					if(Screen.room.block[y][x].groundID == Value.groundGrass && Screen.room.block[y][x].airID == Value.airAir) {
	            						Screen.room.block[y][x].airID =  heldID;
	            						Screen.money -= buttonPrice[realID];
	            						holdsItem = false;
	            						upgradeStore = true;
	            						if(Screen.room.block[y][x].airID >= 2 && Screen.room.block[y][x].airID <= 7)//2-7 towers in Value.
	            						{UpgradeScreen = Screen.room.block[y][x].airID -1;
	            						}
	            					}
	            				}
	            			}
	            		}
	            	}
				}
			}
		}
		System.out.println("Store=" + store);
		System.out.println("UpgradeStore=" + upgradeStore);
		System.out.println("UpgradeScreen=" + UpgradeScreen);
	}

Thanks for helping me all, really thanks for that!

-Roseslayer
Thanks