1

我试图让我的CCSprite来一个滑翔停止而不是突然停止但是我不太确定如何做到这一点。我正在移动一个CCSprite使用CCActionMoveToCCEaseOut基于用户点击的位置;精灵会移动,但不会停止。我的代码如下:

-(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];
}
4

2 回答 2

1

提高宽松率,效果更显着。2 较低,在该值下可能并不明显。也许你也愿意CCEaseExponentialOut

于 2014-02-19T18:59:10.497 回答
0

我建议您阅读http://www.raywenderlich.com/24824/introduction-to-ai-programming-for-games教程,特别是“转向”部分

于 2014-02-19T18:10:50.537 回答