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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:09:33+00:00 2026-05-31T00:09:33+00:00

I am using cocos2d and have the following code which moves my layer based

  • 0

I am using cocos2d and have the following code which moves my layer based on the player touching the screen. For some reason, each time the code is called the position of the layer shifts by 32 in one direction or the other. I cant fathom why its happening. There is no other code anywhere in the program that manipulates the position of these CCNodes (or any other Node).

-(void) animateStructure:(int)index And:(CCSprite*)aSprite At:(CGPoint)aPoint {
    CGPoint point1 = self.position;
    CGPoint point2 = playerSprite.position;

    id move = [CCMoveBy actionWithDuration:0.1 position:ccp(32*tempx,32*tempy)];
    [self runAction:move];    
    id move2 = [CCMoveBy actionWithDuration:0.1 position:ccp(-32*tempx,-32*tempy)];
    [playerSprite runAction:move2];

    self.position = point1;
    playerSprite.position = point2;
}
  • 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-31T00:09:34+00:00Added an answer on May 31, 2026 at 12:09 am

    not certain how the move actions will play-out if you set the position while the action is in progress, as is the case here.

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

Sidebar

Related Questions

i have an app using cocos2d, Im moving some sprites and having animations when
I'm using cocos2d for mac (1.0.1) I have these two methods (which are similar
I have a very strange error using NSMutableArray in cocos2d/xcode In my code, I
I am using cocos2d-iphone to place Sprites onto a Layer to setup a game
I am using Cocos2D for my main framework. In some cases, I want Cocos2D
Let us say we have some code that looks like below: @interface SomeClass :
I am writing the code using cocos2d. I want to release all the memory
I have a very simple game using Xcode v4.2.1, Cocos2d v5.0.1. I've tried both
If I have two objects in chipmunk (I'm using cocos2d-iphone), once I've detected that
I'm using cocos2d with objective C. I have a class called CrystalineBubble that is

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.