box2d 游戏中的移动背景
好的,所以我想找到一些关于如何为 box2d 游戏创建移动背景的教程。我第一次做,不知道叫什么?谁能告诉我它们叫什么,这样我就可以搜索一些教程。
这就是我想做的。首先,我的游戏处于纵向模式,我创建了一个 960x320 的图像,我希望它不断作为游戏的背景运行......就像一条永远持续的路......
有人可以告诉我我可以在谷歌上搜索什么来找到完成此任务的好教程吗?谢谢
ok so im trying to find some tutorials on how to create a moving background for a box2d game. it my first time doing it, and i dont know what they are called? can anyone tell me what they are called so i can search for some tutorials on it..
heres what im trying to do.. firstly my game is in portrait mode, and i have created an image which is 960x320 and i want it to continually run as the background of the game.... like a road which goes on forever..
can someone tell me what i can search on google to find a good tutorial for accomplish this? thankyou
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最喜欢的 cocos2D 教程网站之一是 Ray Wenderlich。
你会在那里找到大量的 cocos2d 材料。
One of my favourite sites for cocos2D tutorials is Ray Wenderlich.
You'll find loads of cocos2d material there.
您可以获取 CCParallaxScrollNode 的教程,通过它您可以实现背景的无限滚动。我不知道确切的链接,但您需要下载四个文件,它们是
现在,在您的测试演示中,在您的 .h 文件中实现以下代码,
代码位于
您需要的 .mm 文件中在 @implementation 之前声明,
在 init 方法中设置以下代码
精灵可以替换为您自己的精灵,也可以对景观进行一些修改 还。该代码适用于肖像模式
You can get the tutorial of the CCParallaxScrollNode by which you can do the endless scrolling of the Background. I dont know the exact link but you need to download the 4 files they are
Now in your test demo implement the below code
in your .h file code is
in .mm file you need to declare before @implementation set
the below code in init method
The sprites can be replaced with your own sprites also you can do some modification for the Landscape also. The code is for the portrait mode