怎样才能让动作更流畅呢?
我正在为 iPad 编写我的第一个游戏。我在动画方面遇到了一个小问题。在这个游戏中,我有一个球在屏幕上弹跳。我以这种方式移动球 球
CGRect frameRect = ball.frame;
frameRect.origin.x += ballMovement.x;
frameRect.origin.y += ballMovement.y;
ball.frame=frameRect;
移动但动画有时不是很流畅...奇怪的是,当我在 ipad 上测试我的应用程序时,我发现如果我关闭应用程序并从多任务栏重新打开它球移动得更好!动画更流畅、更快...... 有人可以解释为什么会发生这种事吗?
谢谢你!!来自意大利的丹尼尔
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 faster...
Can somebody explain why is happening this thing?
Thank you!! Daniel from Italy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果重新打开应用程序可以顺利进行,那么很可能第二次缓存了第一次未缓存的内容。您发布的 4 行代码中没有任何内容可以解释缺乏流畅性的原因。也许发布更多代码会有所帮助。
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.