Cocos2d:多层透视效果
我想通过使用几个层、以不同的速度滚动来在我的游戏中使用透视图效果。我有三层。我的背景是底层,它滚动非常慢,所以它可以比水平小几倍。我的“半背景”是第二层,位于前景和背景之间。它以中等速度滚动,比背景快,但比前景慢。第三层是前景,它以速度滚动,我的角色移动。 对于滚动前景,我只需对 CCLayer 使用 CCFollow 操作,其中放置所有对象。 现在我很困惑,实现第一层和第二层的最佳方法是什么。 cocos2d 是否有任何类似于 CCFollow 的操作,但具有自定义速度(速度不是最好的词,但很难找到适合我的术语)? 我的背景和“半背景”图像是平铺纹理。
I want to use in my game effect of perspective view by using few layers, scrolling with different speed. I have three layers. My background is bottom layer, it scrolls very slowly, so it can be in a few times smaller than level. My "semi-background" is second layer, which lays between foreground and background. It scrolls with medium speed, faster than background, but slower than foreground. Third layer is foreground, it scrolls with speed, that my character moves.
For scrolling foreground I simply use CCFollow action for my CCLayer, where all objects are placed.
Now I'm confused, what is the best way to implement my first and second layers. Does cocos2d have any actions, similar to CCFollow, but having custom speed (speed is not best word to use, but it's difficult to find appropriate term for me)?
My background and "semi-background" images are tiled textures.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
描述您正在寻找的内容的术语是“视差滚动”。 Steffan Itterheim 的书中有一整章专门介绍它。
我找到了这个教程< /a> 通过 Google 快速搜索。(上面的死链接。此视频。)
希望对您有所帮助!
麦克风
The term that describes what you're looking for is "parallax scrolling". There's an entire chapter devoted to it in Steffan Itterheim's book.
I found this tutorial in a quick Google search.(Dead link above. Wayback Machine led me to this video.)
I hope that helps a little bit!
Mike