mm24
mm24

Reputation: 9606

Cocos2D: how to tweak CCMenuItem with only one sprite?

how could I tweak CCMenuItemSprite to support only one sprite?

Currently I have:

[CCMenuItemSprite itemWithNormalSprite:one selectedSprite:selectedOne] 

But would like to have:

[CCMenuItemSprite itemWithNormalSprite:one] 

EDIT: I want to modify CCMenuItem to work only with one CCSprite and not two. So I need to change also the internal methods.

Upvotes: 0

Views: 419

Answers (3)

Guru
Guru

Reputation: 22042

try this, just change colour of seleted sprite.

CCSprite *sprite1   = [CCSprite spriteWithFile:@"Button.png"];
CCSprite * sprite2  = [CCSprite spriteWithFile:@"Button.png"];
sprite2.color = ccc3(128, 128, 128);

CCMenuItemImage *itemEasyLevelImage = [CCMenuItemImage  itemWithNormalSprite:sprite1
                                                              selectedSprite:sprite2
                                                                       block:^(id sender){}];

Upvotes: 0

David
David

Reputation: 1908

You could just use

[CCMenuItemSprite itemWithNormalSprite:one selectedSprite:one]

this way, nothing would happen when you select the sprite

Upvotes: 1

anon_dev1234
anon_dev1234

Reputation: 2153

You can just use the same (normal) sprite as the selected sprite. When clicked, the button will then do nothing.

Upvotes: 1

Related Questions