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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:37:19+00:00 2026-05-31T05:37:19+00:00

I have a method: -(void)myMethod:(id)sender { CCMenuItemSprite *anItem = (CCMenuItemSprite *)sender; // select animation

  • 0

I have a method:

-(void)myMethod:(id)sender {

    CCMenuItemSprite *anItem = (CCMenuItemSprite *)sender;

    // select animation
    [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"Animation.plist"];

    CCSpriteBatchNode *animationBatchNode = [CCSpriteBatchNode batchNodeWithFile:@"Animation.png"];
    [animationBatchNode addChild:anItem];

    CCSprite *sprite = [CCSprite spriteWithSpriteFrameName:@"Animation_01.png"];

    [sprite setScaleX: anItem.contentSize.width/sprite.contentSize.width];
    [sprite setScaleY: anItem.contentSize.height/sprite.contentSize.height];
    [sprite setPosition:ccp(anItem.position.x, anItem.position.y)];


    NSMutableArray *animFrames = [NSMutableArray array];
    for(int i = 1; i <= 7; ++i) {
        [AnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"Animation_%02d.png", i]]];
    }

    CCAnimation *anim = [CCAnimation animationWithFrames:animFrames delay:0.05f];
    CCActionInterval *animAction = [CCAnimate actionWithAnimation:anim restoreOriginalFrame:NO];

    id seq = [CCSequence actions: animAction, [CCCallFunc actionWithTarget:sprite selector:@selector(removeFromParentAndCleanup:)], [CCCallFunc actionWithTarget:anItem selector:@selector(removeFromParentAndCleanup:)], nil];
    [sprite runAction:seq];
    [anItem addChild:sprite];
}

Anyone can help me how to positionate the animation correctly? Right now is placed somewhere else on the screen but I want to place it just above it…

  • 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-31T05:37:20+00:00Added an answer on May 31, 2026 at 5:37 am

    Make position relative to the current position and size of the menu. Something like

    [sprite setPosition:ccp(anItem.boundingBox.size.width/2, anItem.boundingBox.size.height + sprite.boundingBox.size.height/2)];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method -(void)myMethod:(MyObject*)obj And I am detaching a new thread [NSThread detachNewThreadSelector:@selector(myMethod)
If I have a method such as: public void MyMethod(int arg1, string arg2) How
If I have a method - (void) myMethod:(NSString *)string { [Object anothermethodWithString:string]; } and
I have a method public void MyMethod(decimal val) { } I want to call
So if you have a method prototype like void myMethod() . What does that
I have a method which calls an Action<string> public Action<string> DisplayError; public void MyMethod()
I have a gridview with a onrowdeleting=SellersGridView_RowsDeleting switch. My method is: protected void SellersGridView_RowsDeleting(object
Imagine I have a method: void Method(bool parameter){ if(parameter){ // first case } else
I have an interface method public void Execute(ICommand command); which needs to pass known
I have this method: private delegate void watcherReader(StreamReader sr); private void watchProc(StreamReader sr) {

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.