Hi,
I just create a MoveTo action using cocos2d-x V3.0, and i noticed that isn’t smooth(jumpy),and the sprite will be not clear until reach the destination.
The MoveTo code
void Piece::moveTo(cocos2d::Vec2 position , float duration) {
auto move = MoveTo::create(duration, position);
this->runAction(move);
}
Could you explain to me, why this happen ?
Thanks.
Actions are based on time.
So if framerate is not stable, it may not look smooth.
Let’s assume you made a MoveTo that should be finished 1 second.
It should be finished in 1 second.
And for this situation, let’s assume each frames are rendered in
0.1s, 0.1s, 0.1s, 0.1s, 0.1s, 0.1s, 0.1s, 0.1s, 0.1s, 0.1s.
then it looks like smooth.
but how about in 0.1s, 0.1s, 0.1s, 0.3s, 0.1s, 0.1s, 0.1s, 0.1s?
first 3 frames are looks like smooth.
But at 4th frame, sprite should be positioned at 0.6s.
At this point, you feel jumpy.
otherwise, MoveTo action will not be finished in 1s. it will take more time.
I was getting tons of movement stutter after creating 9000 near identical sprites in an attempt to emulate particle effects, most were kept off screen most of the time but their mere existence was felt to be a problem.
I ended up recycling (repeating) them instead. I still had stutter even with about 100 or 200, even in signed build.
Eventually it is working smoothly again. I think turning off debugging flags might have helped. This was using a spriteBatchNode.
It should work, given, cpp-tests as reference, but I had (one or ten) other things on screen to perhaps afflict the spriteBatchNode. What I learnt was that spriteBatchNode was no panacea for sloppy programming. Not that that’s what your doing. Just my recent experience.