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 7545689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:59:40+00:00 2026-05-30T08:59:40+00:00

My problem: I have created a parent sprite which rotates forever. I have created

  • 0

My problem: I have created a parent sprite which rotates forever. I have created a child sprite to it which I want to move along with the parent sprite but not rotate it. My scenario exactly is that the parent sprite is a windmill and I am rotating it, but the child sprite is a bucket at the end of one windmill bar. So when the windmill rotates, I want the bucket to just move in that motion, where as now its moving and also rotating which looks unrealistic.

Here is the code:

CGSize winSize = [CCDirector sharedDirector].winSize;

windmill = [CCSprite spriteWithFile:@"Chorki.png"];
windmill.position = CGPointMake(winSize.width*0.02f, winSize.height*0.56f);
windmill.scale = 0.55f;
[self addChild:windmill z:0];
//Add windmill sprite on screen

CCRotateBy *rot = [CCRepeatForever actionWithAction:[CCRotateBy actionWithDuration:5 angle: 360]];
    [windmill runAction:rot];
//The above code to rotate windmill, the next code is to add child sprite of bucket

CCSprite *bucket1 =  [CCSprite spriteWithFile:@"BucketBug.png"];
bucket1.position = ccp(235, 490.2f);
[windmill addChild:bucket1 z:-1]; 

EDIT 1:

Sorry I forgot to show the code to rotate the sprite. Now its added.

  • 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-30T08:59:41+00:00Added an answer on May 30, 2026 at 8:59 am

    Take a look at the ccHonorParentTransform enum:

    /**
     Whether or not an CCSprite will rotate, scale or translate with it's parent.
     Useful in health bars, when you want that the health bar translates with it's parent but you don't
     want it to rotate with its parent.
     @since v0.99.0
     */
    typedef enum {
        //! Translate with it's parent
        CC_HONOR_PARENT_TRANSFORM_TRANSLATE =  1 << 0,
        //! Rotate with it's parent
        CC_HONOR_PARENT_TRANSFORM_ROTATE    =  1 << 1,
        //! Scale with it's parent
        CC_HONOR_PARENT_TRANSFORM_SCALE     =  1 << 2,
        //! Skew with it's parent
        CC_HONOR_PARENT_TRANSFORM_SKEW      =  1 << 3,
    
        //! All possible transformation enabled. Default value.
        CC_HONOR_PARENT_TRANSFORM_ALL       =  CC_HONOR_PARENT_TRANSFORM_TRANSLATE | CC_HONOR_PARENT_TRANSFORM_ROTATE | CC_HONOR_PARENT_TRANSFORM_SCALE | CC_HONOR_PARENT_TRANSFORM_SKEW,
    
    } ccHonorParentTransform;
    

    It is set through the following property of CCNode:

    /** whether or not to transform according to its parent transfomrations.
     Useful for health bars. eg: Don't rotate the health bar, even if the parent rotates.
     IMPORTANT: Only valid if it is rendered using an CCSpriteBatchNode.
     @since v0.99.0
     */
    @property (nonatomic,readwrite) ccHonorParentTransform honorParentTransform;
    

    Note that this will only work if the sprites are in a CCSpriteBatchNode. Since mine was not, I decided to let the parent node update the child node by settings the rotation of the child equal to the opposite of its own rotation, thus keeping the child’s rotation relative to the world constant.

    // In a scheduled update function of the parent, see CCNode header for schedule functions
    bucket.rotation = -self.rotation;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with dynamically created image (JavaScript). I want to change the innerHTML
I have created a parent and a child process using fork( ), and both
Hey guys, I have created a tree which is not a binary tree. Now,
I have problem on deleting component which is created on runtime. Please help me.
I have created Excel Sheet using Java program. It works fine. My problem is,
Here is my problem. I have created a pretty heavy readonly class making many
I am having a problem using the Unity Application Block, I have created a
I'm having a problem with mixing managed and unmanaged code. I have created two
I have problem with Oracle 9.2 and JMS. I created PL/SQL routine to send
I have a peculiar problem. I created a normal Objective C class called SampleTable.

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.