开发者

How can I make the motion smoother?

开发者 https://www.devze.com 2023-03-02 20:28 出处:网络
I\'am programming my first game for Ipad. I have a little problem on an animation. In this game I have a ball bouncing around the screen. I move the ball in this way

I'am programming my first game for Ipad. I have a little problem on an animation. In this game I have a ball bouncing around the screen. I move the ball in this way

CGRect frameRect = ball.frame;  
frameRect.origin.x += ballMovement.x; 
frameRect.origin.y += ballMovement.y;
ball.frame=frameRect;

The ball moves but the animation is sometimes not very smooth... The strange thing is that while I was testing my app on my ipad I discovered that if I close the app and reopen it from the multitasking bar the ball moves way way better! The animation is smoother and fas开发者_如何转开发ter... Can somebody explain why is happening this thing?

Thank you!! Daniel from Italy


If reopening the application makes it smooth, then most likely something has been cached the second time that was not cached the first time. There's nothing in the 4 lines of code you posted that could explain the lack of smoothness. Maybe posting more of the code would help.

0

精彩评论

暂无评论...
验证码 换一张
取 消