Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6538519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:44:43+00:00 2026-05-25T10:44:43+00:00

I just started a game using cocos2d-iphone and I am trying to add a

  • 0

I just started a game using cocos2d-iphone and I am trying to add a pause botton in my hud.
My hud will have:

  • Time left
  • HP bar
  • Pause button

I have been reading Ray Wenderlich’s tutorials and he mentions for buttons CCMenuItemImage should be used. I first did:

CCMenuItemImage *pauseButton = [CCMenuItemImage itemFromNormalImage:@"hud_pause_bt.png" selectedImage:@"hud_pause_bt.png" target:self selector:@selector(pauseAction:)];
pauseButton.position = ccp(winSize.width - pauseButton.rect.size.width/1.8, winSize.height - pauseButton.rect.size.height/1.8);

[self addChild:pauseButton];

but I was never reaching the pauseAction method. Afterwards I tried adding the CCMenuItemImage to a CCMenu with the following code:

CGSize winSize = [CCDirector sharedDirector].winSize;

CCMenuItemImage *pauseButton = [CCMenuItemImage itemFromNormalImage:@"hud_pause_bt.png" selectedImage:@"hud_pause_bt.png" target:self selector:@selector(pauseAction:)];

pauseButton.position = ccp(winSize.width - pauseButton.rect.size.width/1.8, winSize.height - pauseButton.rect.size.height/1.8);

CCMenu *pauseMenu = [CCMenu menuWithItems:pauseButton, nil];
pauseMenu.position = CGPointZero;
[self addChild:pauseMenu];

In this case the touches work but it feels wrong to create a CCMenu just to make my CCMenuItemImage clickable.

What do you think?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:44:44+00:00Added an answer on May 25, 2026 at 10:44 am

    The way you have done it is correct. That is the way CCMenu and CCMenuItems are designed to be used.

    Consider just using a CCStandardTouchDelegate combined with CGRectContainsPoint if you don’t like that method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started trying to make a simple game with XNA 3.1 to
I recently started game programming on the iPhone using Cocos2d and Box2d. So here's
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I'm just getting started on making a board game using Cocoa/Objective-C. My plan is
I've just started trying to integrate the Poco C++ Library with our game engine,
Me and my friend started developing a game just like Zelda for SNES using
I have started programming a game for the iphone and as all beginners I
I'm new to XNA game development and I have just started to write a
i just started learning actionscript 3 and i have a question. I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.