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

The Archive Base Latest Questions

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

Is there any alternative for CCMoveBy Action in cocos2d in iphone ?? If anybody

  • 0

Is there any alternative for CCMoveBy Action in cocos2d in iphone ??

If anybody know about this.. plz reply.

  • 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-24T09:09:31+00:00Added an answer on May 24, 2026 at 9:09 am

    An alternative to using actions to move sprites is to use simple physics. You can extend the CCSprite class to include an update method as well as ivars / properties to keep track of x and y velocity.

    In the update method, move the sprite by velocity * dT in each direction.
    Call the sprites update method in the update method of your game scene.

    MovingSprite.h

    #import <Foundation/Foundation.h>
    #import "cocos2d.h"
    @interface MovingSprite : CCSprite {
        float _vx;
        float _vy;
    }
    
    -(void) update:(ccTime)dt;
    
    @property (nonatomic, assign) float vx;
    @property (nonatomic, assign) float vy;
    
    @end
    

    MovingSprite.m

    #import "MovingSprite.h"
    
    @implementation MovingSprite
    
    @synthesize vx = _vx;
    @synthesize vy = _vy;
    
    -(void)update:(ccTime)dT
    {
        self.vy -= (kGravity * dT); //optionally apply gravity
        self.position = ccp(self.position.x + (self.vx*dT), self.position.y + (self.vy*dT));
    }
    

    And add [self scheduleUpdate]; to the init method of your game layer. Then add an update method within the game layer where you call update for all moving sprites.

    Now you just need to add collision detection to check if the car collides with the sides of the track.

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

Sidebar

Related Questions

Is there any alternative to this: Organizations.Include(Assets).Where(o => o.Id == id).Single() I would like
Is there any generic alternative / implementation for MemoryCache? I know that a MemoryCache
Is there any alternative for getting uri with changed parameter as $this->request->uri($params) in KO
is there any alternative bitmap class, where PixelFormat.Format16bppGrayScale , or something like this, is
I know in .NET 4 you can use HasFlag Is there any alternative to
are there any alternative to transactionScope which does not need to enable DTC?? In
Is there any alternative to Axis2? Or the way to make it work (different
Are there any alternative to xlrd, xlwt and xlutils for handling MS Excel in
Is there any alternative to use like tag to property of UIView? The thing
Is there any similar peek(); (From C++) function in ruby? Any alternative to do

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.