[Solved] Selectable Objects

Hi

So I’m working on my current project and I have a menu that displays saved profiles along with slots to create a new profile. I also have a button that tells the state manager to load the profile.

Pastebin: http://pastebin.java-gaming.org/30c3262879a

If anybody has any thoughts or needs to see more samples, please reply! Hope somebody can help solve my conundrum :slight_smile:

CopyableCougar4

PS: Sorry for posting so many questions :slight_smile:

So whats your problem?

Either all objects get selected, or none get selected. In the instance where they all get accepted, it’s when I keep them active due to ignoring the region of the button to submit. None get selected when I don’t ignore the selected region.

CopyableCougar

Lol this seems to happen a lot… Anyways I found my problem :slight_smile: I just stored the state of the button before the click check and if the click was in the button I set the state to the stored state :slight_smile:

Changed code


boolean state = active; // added this line.
if(click.intersects(bounds)){
	// active!
	active = true;
} else {
	// not active.
	active = false;
}
// The click is in the button
if(exception.inRegion(click)){
	// exception.checkClick();
	active = state; // changed this from true to state
}

I think what helps with posting my problems is when I explain them I have to think them out, which either presents a solution or a helpful forum user presents one :slight_smile:

CopyableCougar4