面向专家的 iOS 3d
我开发了一些简单的 iOS 应用程序,并且希望开发一个简单的迷宫游戏。我想要做的事情非常基本,所以我正在寻找一些关于走哪条路的指导。
这基本上就是我想做的事情:简单的逃脱迷宫游戏,我在二维数组中读取内容,这构成了我的迷宫。
我希望视角站在每个方格的中间,当你轻弹或点击按钮时,它会前进一个方格,你可以向左或向右转动。我希望能够根据数组中的数字将纹理应用到路径上,并且我真的很想看到墙向我移动然后停止的运动。
墙壁总是相同的高度,迷宫将是简单的方块,尽管我确实希望它能够提供可能超过 2x2 的房间,比如 4x4 ,并且能够处理渲染。
我不确定尝试在 OpenGL 中做某事是否会太过分,因为我的要求非常基本。就像我提到的,这不会是一个自由的举动;每次您按下按钮并左转或右转时,它都会前进一格。
我读过一些关于此类事情的光线投射的内容,但不确定如何在 iOS 中实现这一点。另外,我希望迷宫不占据整个屏幕,也许是 2/3,而其余部分是标准 iOS 控件,如按钮和标签,以及其背后的背景。
我应该阅读哪些书籍或文章来帮助我?我不想使用第三方引擎,因为这看起来非常基本。
I've developed a few simple iOS apps, and I'm looking to develop a simple maze game. What I'm looking to do is really basic, so I'm looking for some guidance on which way to go.
Here is basically what I'm trying to do: simple escape-the-maze game where I read in a 2 dimensional array and that makes my maze.
I want the perspective to be standing in the middle of each square, and when you flick or hit a button, it will advance one square, and you can turn left or right. I'd like to be able to apply textures to the ways based on the numbers in the array, and I'd really like to see the movement of the wall moving towards me then stop.
The walls will always be the same height, and the maze will be simple square blocks, although I do want it to be able to hand rooms that might be more than 2x2 , like maybe 4x4, and be able to handle rendering that.
I'm not sure if trying to do something in OpenGL would be overkill since my requirements are really basic. Like I mentioned, it won't be a free move; it will be advance one square each time you hit a button and turn left or right.
I have read something about ray casting for this sort of thing but am not sure how I would accomplish this in iOS. Also I'd like to have the maze not take up the whole screen, maybe 2/3, while the rest is standard iOS controls like buttons and labels, and a background behind it.
What books or articles should I read to help me? I'd prefer not to use a 3rd party engine since this seems really basic.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 Core Animation 来完成此操作,这比 OpenGL 容易得多。如果将 QuartzCore 导入到项目中,则可以按如下方式定位任何 3D 视图:
因此,如果将墙壁创建为 UIImageView,则可以使用上述逻辑单独转换每个墙壁,将它们排列到一个房间中。
You can do this using Core Animation, which is much easier than OpenGL. If you import QuartzCore into your project, you can position any view in 3D as follows:
So if you create your walls as UIImageViews, you can arrange them into a room by transforming each one individually using the logic above.