我谨简单CCSprite
使用此代码的iOS设备的屏幕上:流畅的动画为iOS
[self schedule:@selector(update:) interval:0.0167];
- (void) update:(ccTime) delta {
CGPoint currPos = self.position;
currPos.x += xVelocity;
currPos.y += yVelocity;
self.position = currPos;
}
这工作但动画并不顺利。 如何提高动画的平滑度?
我的场景是非常简单的(只有一个全屏CCSprite
背景图像和一个相对较小的CCSprite
,移动缓慢)。
我记录了ccTime delta,它不一致(它几乎总是大于我指定的0.0167区间...有时达到4x的因子)。
我已经考虑将更新方法中的运动定制为增量时间(较大的增量=>较大的运动等)。然而,考虑到我的场景简单,似乎有一个更好的方法(以及我可能缺少的一些基本的东西)。
使用delta也是教程中采用的方法。 http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:lesson_2._your_first_game –
我尝试了三角洲方法。不幸的是它没有奏效。按照andrewx的建议使用'scheduleUpdate'运行良好。 – SundayMonday