CCSprite 遵循随机路径? (科科斯2D)
我在设计我的第一个 cocos2d 游戏时遇到了一些困难,非常感谢您的帮助。
该游戏基本上是一款横向卷轴游戏,英雄(在滑板上)会进入不同的路径(线性、圆形、曲线等),如下图所示:
http://www.legendstyler.com/cocosq.jpg
这是我的问题:
绘制路径并让精灵跟随的最佳方法是什么它们(尤其是圆形 绘制路径
如果我想让跳跃和着陆看起来更真实,我需要使用物理引擎吗?它会让我的碰撞检测或跟踪路径变得更轻松吗?
请注意,我将按随机顺序和距离放置路径。我不打算用固定元素绘制关卡。
非常感谢,祝你有美好的一天 =)
I'm facing some difficulties in the design of my first cocos2d game and I'd really appreciate your help.
The game is basically a side-scroller and the hero (on a skateboard) runs into different paths (linear, circular, curvy, .. etc) as drawn in this sketch:
http://www.legendstyler.com/cocosq.jpg
Here are my questions:
What is the best approach for drawing paths and letting a sprite follow them (especially circular paths) ?
If I'd like the jumping and landing to look realistic, do I need to use a physics engine ? will it make my life easier in collision detection or following paths ?
Please note that I'm going to place the paths in random order and distances. I'm not planning to draw a level with fixed elements.
Many thanks and have a good day =)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果那应该是一条虚线,那么您可以使用 cos 和 sin 来计算它。如果玩家应该绘制它,那么您可以使用数组来存储 x,y 坐标。
If that should be an imaginary line, then you could calculate it using cos and sin. If the player should draw it, then you might use an array to store the x,y coordinates.