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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:44:47+00:00 2026-05-23T21:44:47+00:00

I am animating 3 images (sprites) from off screen to the right into the

  • 0

I am animating 3 images (sprites) from off screen to the right into the middle of the screen. I have written the code below, but was wondering if there was a more efficient way of coding it.

-(void) displayMenu
{
    CGSize screenSize = [[CCDirector sharedDirector] winSizeInPixels];

    CCSprite* menuItemBottle = [CCSprite spriteWithFile:@"btn_i_have_norm.png"];
    menuItemBottle.position = ccp((screenSize.width * 2), 600.0f);
    menuItemBottle.contentSize = screenSize;
    menuItemBottle.scale = 1;
    [self addChild:menuItemBottle z:0 tag:4];

    CCSprite* menuItemAdvert = [CCSprite spriteWithFile:@"btn_see-ad_norm.png"];
    menuItemAdvert.position = ccp((screenSize.width * 2), 500.0f);
    menuItemAdvert.contentSize = screenSize;
    menuItemAdvert.scale = 1;
    [self addChild:menuItemAdvert z:0 tag:5];

    CCSprite* menuItemNoBottle = [CCSprite spriteWithFile:@"btn_dont-have_norm.png"];
    menuItemNoBottle.position = ccp((screenSize.width * 2), 400.0f);
    menuItemNoBottle.contentSize = screenSize;
    menuItemNoBottle.scale = 1;
    [self addChild:menuItemNoBottle z:0 tag:6];

    CGPoint newPointBottle = CGPointMake(screenSize.width * 0.5f + 50, 600.0f);
    CCMoveTo *moveBottle = [CCMoveTo actionWithDuration:0.7f position:newPointBottle];
    CCSequence *sequenceBottle = [CCSequence actions:moveBottle, nil];
    [menuItemBottle runAction:sequenceBottle];

    CGPoint newPointAdvert = CGPointMake(screenSize.width * 0.5f + 50, 500.0f);
    CCMoveTo *moveAdvert = [CCMoveTo actionWithDuration:0.7f position:newPointAdvert];
    CCSequence *sequenceAdvert = [CCSequence actions:moveAdvert, nil];
    [menuItemAdvert runAction:sequenceAdvert];

    CGPoint newPointNoBottle = CGPointMake(screenSize.width * 0.5f + 50, 400.0f);
    CCMoveTo *moveNoBottle = [CCMoveTo actionWithDuration:0.7f position:newPointNoBottle];
    CCSequence *sequenceNoBottle = [CCSequence actions:moveNoBottle, nil];
    [menuItemNoBottle runAction:sequenceNoBottle];

}
  • 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-23T21:44:48+00:00Added an answer on May 23, 2026 at 9:44 pm

    You should be able to get all of the actions down to a single line. The first one would end up looking like this:

    [menuItemBottle runAction:[CCMoveTo actionWithDuration:0.7f position:ccp(screenSize.width * 0.5f + 50, 600.0f)]];

    If you’d prefer to define the position outside of the action then you could continue to do that. Just FYI a CCSequence is for when you want to run actions on the same object consecutively (i.e. a move action runs and when it’s done a rotate action runs).

    Also I don’t believe you need to set the scale to 1 for each of the images as I believe it is already set to that.

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

Sidebar

Related Questions

I'm animating these images being raised from the bottom of the screen and rotated.
I have a one spritesheet image with all sprites, I downloaded this image from
I have noticed that when placing PNG images into a view using IB and/or
I have about 650 gif files with sprites, but I can't display them animated
Following on from this question: How should I go about animating over 200 images
How to integrate two images where one act as default and another as animating
i want create image animation , i have 50 images with png format now
we're loading about 30 full 320 x 480 images into an animations array. These
I have a problem with switching images in android. I want to create animation
How do sprites work? I've seen sprites from old school games like Super Mario

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.