Hi Forum, I'm trying to build a preferences screen where a player can select a game piece's size. I'd like to have three buttons - small, medium, large, and have the selected choice toggle 'on' while the others toggle 'off'. This sounds like what MenuItemToggle was made for, except it shows only one button and toggles between button 1 and button 2. I've tried a few solutions like manually setting button toggles, using sprites and even nesting ItemToggles. No joy.
Is MenuItemToggle only good for displaying a single menuItems in its container of menuItems, or can it toggle amongst 'three-in-a-row' MenuItems? I want to display all three toggle options on screen at the same time, not cycle through 'hidden' options in the toggle stack.
#pragma mark Game Piece sizes
// size one button
MenuItem *smallGamePieceBtn = [MenuItemImage itemFromNormalImage:@"pieceOne_small_up.png"
selectedImage:@"pieceTwo_small_down.png"
target:self
selector:@selector(fake:)];
[smallGamePieceBtn setPosition:ccp(-75,54)];
// size two button
MenuItem *mediumGamePieceBtn = [MenuItemImage itemFromNormalImage:@"pieceTwo_big_up.png"
selectedImage:@"pieceTwo_big_down.png"
target:self
selector:@selector(fake:)];
[mediumGamePieceBtn setPosition:ccp(64,60)];
// size three button
MenuItem *LargeGamePieceBtn = [MenuItemImage itemFromNormalImage:@"pieceThree_big_up.png"
selectedImage:@"pieceThree_big_down.png"
target:self
selector:@selector(fake:)];
[LargeGamePieceBtn setPosition:ccp(126,65)];
#pragma mark Game Piece size toggle
MenuItemToggle *sizeToggle = [MenuItemToggle itemWithTarget: self
selector:@selector(sizeSelect:)
items: SmallGamePieceBtn, MediumGamePieceBtn, LargeGamePieceBtn, nil];
This will toggle one image and it ignores the button positioning, but how does one toggle three images? Is it better to just code that action manually?
Thanks for sharing your ideas.