I have this part of my game where once a certain state of the level is reached, the "End Game" button turns into the "Next Level" button. How do I change the button and the selector for that?
- I am using CCMenuItemImage for this.
Furthermore, I have this array of letters (as images) that I display on the scr开发者_JAVA技巧een, and each time the user clicks a button, it shuffles the letters. Note that the letters are in a horizontal position. How do I update the letter positions?
Some other notes:
- I have a variable that holds the letters in the array, and the function not only does [array shuffle];, it should shuffle the letters according to that as well
Thanks for the help guys!
Whatever method that sets the End game variable should probably also set the menu item as well.
I was also looking for such an answer, but i could not find it.
In my situation i wanted to change the image from a disabled to an enabled menuitem, like menuItemSearchOff and menuItemSearchOn.
I found a solution for my problem by adding double menuitems with the same menuitem properties, except with a different images.
On init i set one of the menuitem.visible to false and the other to true; Then when i want the change the image of the menuitem i swap the visibility of the menuitem from true to false and the other vice versa;
When you swap menuitems for making menu items available or unavailable and change their images, don't forget to set the "unavailable" menuitem property to false, or it still will react to the touches. Example: menuItemSearchOff.isEnabled = false. This action will show the image, but it will not react to touches.
精彩评论