0
votes

Im trying to make the play button on the main menu of my game in Cocos2d which is an image file. I set up the sprite as playButton with the image Play Button.png. When I ran the app it gave me an error that the "itemFromNormalSprite:selectedSprite:target:selector." is deprecated. Anybody have a solution to this problem? Here is my code:

CCMenuItem *playGameButton = [CCMenuItemSprite itemFromNormalSprite:playButton selectedSprite:playButton target:self selector:@selector(buttonTapped:)];
    CCMenu *menu = [CCMenu menuWithItems:playGameButton, nil];
    menu.position = ccp(size.width/2, size.height/1.5);
    [self addChild:menu z:5];
1
look in ccDeprecated.m what it needs to be replaced withLearnCocos2D
Are all the things in ccDeprecated.m deprecated code? Or does it actually have replacements for the deprecated code?Myers App Development
c'mon @MyersAppDevelopment ... ure one click or one ^F away from the answer.YvesLeBorg
I ended up just doing CCMenuItemImage. I get it now thanks.Myers App Development

1 Answers

0
votes
    CCMenuItem *playGameButton = [CCMenuItemImage itemFromNormalImage:playButton selectedImage:playButton disabledImage:disabledPlayButton target:self selector:@selector(buttonTapped:)];
    CCMenu *menu = [CCMenu menuWithItems:playGameButton, nil];
    menu.position = ccp(size.width/2, size.height/1.5);
    [self addChild:menu z:5];