可以使用UIAnimation来完成吗?
我正在为 iPhone 开发一款游戏,我遇到了一个问题:这是否可以使用 UIAnimation 来完成,或者我必须切换到 OpenGL。
如果您看到上面的图片,您可以意识到有一个矩形(它将有背景图像)里面有很多洞。用户应该触摸孔并启动动画。这些孔实际上在图像上,而不是某些视图。你知道我需要阅读什么文章或教程才能理解这可以使用 UIAnimation 来完成吗?
这更像是国际象棋。当您点击一个孔时,会在 z 轴上放置并移动一个视图,然后当您按下另一个孔时,视图会移动到该孔,依此类推。
I am developing a game for iPhone and I came across a question whether this can be done using UIAnimation or I have to switch to OpenGL.
If you see the picture above, you can realize there is a rectangle (it will have background image) having many holes in it. User is supposed to touch on holes and initiate the animation. The holes are actually on the image and are not some view. Do you know any article or tutorial I need to read in order to understand this can be done using UIAnimation?
It's more like chess. When you tap a hole, there is a view placed and moved at z-axis and then when you press the other hole, the view is moved to that hole and so on.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信也可以使用 UIView 来完成。可以使用其中带有“透明”孔的图像来制作孔。您可以将此
UIView
放置在背景图像的顶部(如果需要)。当检测到触摸时,您可以使用addSubview:
在该视图之上为另一个视图设置动画。您最初可以将另一个视图保留在屏幕边界之外,以便动画看起来像滑动动画。I believe it can be done with
UIView
s too. The holes can be made by using an image with "transparent" holes in it. You can place thisUIView
on top of a background image(if required). When touches are detected, you can animate another view on top of this view usingaddSubview:
. You can keep this other view outside the screen bounds initially so that the animation seems like a sliding animation.是的 UIView 也是你的情况的一个选项。如果你觉得你会使用高质量的大量图形,并且会在屏幕上同时做很多动画,openGL将是最好的,或者你正在制作的gane可能是一个2d游戏,所以你必须考虑COCOS2D“http:// /www.cocos2d-iphone.org/”开始游戏时,您肯定会得到许多效果和其他闪闪发光的东西。最重要的是它是基于 openGL 的..!!性能对你来说太高了..!!
祝你好运..!!
yes UIView is also an option in your case. if you feel that you will use high quality lots of graphic and will do lots of animation stuff at once on the screen, openGL will be the best or perhaps the gane you are making is a 2d game so you must consider COCOS2D "http://www.cocos2d-iphone.org/" for kick starting your game you'll surely get many effects and other glittering stuff with it. and bes of all it is openGL based..!! Performance will be too high for you..!!
Best of luck..!!