Andrey Chernukha
Andrey Chernukha

Reputation: 21808

How to achieve uniform speed of movement in cocos 2d?

I'm an absolute beginner in cocos2 , actually i started dealing with it yesterday. What i'm trying to do is moving an image along Bezier curve. This is how i do it

- (void)startFly
{    
[self runAction:[CCSequence actions:
                 [CCBezierBy actionWithDuration:timeFlying bezier:[self getPathWithDirection:currentDirection]],
                 [CCCallFuncN actionWithTarget:self selector:@selector(endFly)],
                 nil]];

}

My issue is that the image moves not uniformly. In the beginning it's moving slowly and then it accelerates gradually and at the end it's moving really fast. What should i do to get rid of this acceleration?

Upvotes: 1

Views: 199

Answers (1)

user1233894
user1233894

Reputation: 1774

I would recommend checking out the Line Drawing Starter Kit... I have used this for an app to get a sprite to follow a path at a uniform speed

http://www.learn-cocos2d.com/store/line-drawing-game-starterkit/

Upvotes: 1

Related Questions