1

I am trying to make my CCSprite come a gliding stop instead of an abrupt halt however I'm not too sure how to do this. I'm moving a CCSprite using CCActionMoveTo and CCEaseOut based on where the user taps; the sprite does move however doesn't glide to a halt. My code is below:

-(void) touchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
    CGPoint touchLoc = [touch locationInNode:self];
    CCActionMoveTo *actionMove = [CCActionMoveTo actionWithDuration:0.2f position:ccp(touchLoc.x, 150)];
    id ease = [CCEaseOut actionWithAction:actionMove rate:2];
    [_playerSprite runAction: ease];
}

2 Answers2

1

Increase the easing rate to see a more profound effect. 2 is low, and it might not be obvious at that value. Perhaps you would like CCEaseExponentialOut as well.

Mark
  • 876
  • 1
  • 7
  • 11
0

I would recommend you to read http://www.raywenderlich.com/24824/introduction-to-ai-programming-for-games tutorial, specifically the part on "Steering"

Jack
  • 16,677
  • 8
  • 47
  • 51