如何使用 cocos2d 创建带有曲线的关卡 + iPhone 上的 Box2d?

发布于 2024-09-29 13:57:14 字数 361 浏览 5 评论 0原文

我想创建一个具有如下级别的游戏:http://img169。 imageshack.us/img169/7294/picdq.png

玩家“飞”过关卡,并且不能与墙壁碰撞。我怎样才能创建这样的关卡?

我找到了那个软件: http://www.sapusmedia.com/levelsvg/

不是这样的便宜,所以我想知道是否有另一种方法来创建如上图所示的级别......?

I'd like to create a game that has levels such as this: http://img169.imageshack.us/img169/7294/picdq.png

The Player moves "flies" through the level and mustn't collide with the walls. How can I create such levels?

I found that piece of software: http://www.sapusmedia.com/levelsvg/

It's not that cheap, so I wonder whether there is another way to create such a level as shown in the picture above...?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

带刺的爱情 2024-10-06 13:57:14

您可以通过读取关卡特定位置的像素颜色值来轻松完成此操作。举例来说,您的关卡背景是白色,墙壁是黑色。为了执行碰撞检测,无论您的角色是否撞到了墙壁,您都需要执行以下操作:
- 采取你的角色的位置
- 查看地图上与该位置的角色边界框或球体重叠的像素的颜色值
-如果其中任何一个包含黑色,那么您就会发生碰撞:)

现在,如果您的关卡都是彩色的,您可能需要构建一个黑白遮罩纹理来反映实际地图的墙面。然后使用彩色贴图进行绘制,使用黑白贴图进行碰撞检测。

You can do that pretty easy by reading the color value of pixels at specific places of the level. Take for instance that your level background is white and the walls are black. In order to perform collision detection, whether your character had hit the wall, you would do the following:
-take your character's position
-look at the color values of the pixels of your map that overlap with character's bounding box or sphere at that position
-if any of those contain black color you have yourself a collision :)

Now if your level is all colourful, you would want to build a black and white mask texture that would reflect the wall surfaces of your actual map. Then use the coloured map for drawing and the bw map for collision detection.

悸初 2024-10-06 13:57:14

我花了几周的时间来学习 Objective-C、Xcode、Interface Builder 和 Apple iOS 文档。有许多优秀的教程和示例 Xcode 项目可供下载并在 iPhone/iPad 模拟器上运行。

如果刚刚开始,其中一些快速启动库可能会剥夺您在应用程序开始超出代码沙箱边界时创建复杂性和细微差别所需的深入知识。用作学习工具或加快开发时间还不错,但我建议不要将它们用作拐杖,直到您增强了开发人员的能力。爬行。走。跑步!

I'd spend a good solid couple weeks getting caught up on Objective-C, Xcode, Interface Builder, and Apple iOS documentation. There are many good tutorials out there and sample Xcode projects to download and run on the iPhone/iPad simulator.

If just starting out, some of those quick startup libraries can rob you of the intimate knowledge you'll need to create the intricacies and nuances you'll need when your application starts to reach outside the boundaries of the code sandbox. Not bad to use as learning tools or to speed up development time, but I'd advise against using them as a crutch until you strengthen your developer legs. Crawl. Walk. Run!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文