Iphone 像移动的道路一样重复移动背景CCSprite
我是cocos2D新手,我有一个640x1136像素的图像,我静态地将它设置为背景精灵。现在我想移动这个精灵,像向上移动背景一样不断地移动。在Iphone 像移动的道路一样重复移动背景CCSprite,iphone,cocos2d-iphone,Iphone,Cocos2d Iphone,我是cocos2D新手,我有一个640x1136像素的图像,我静态地将它设置为背景精灵。现在我想移动这个精灵,像向上移动背景一样不断地移动。在init方法中设置下面的代码。这是我的代码: background = [CCSprite spriteWithFile:@"bgImagevertical.png"]; background.scaleX = 1; background.scaleY = 1; NSLog(@"size X :: %f && Y
init
方法中设置下面的代码。这是我的代码:
background = [CCSprite spriteWithFile:@"bgImagevertical.png"];
background.scaleX = 1;
background.scaleY = 1;
NSLog(@"size X :: %f && Y :: %f",size.width,size.height);
background.position = ccp(size.width/2,size.height/2);
[self addChild:background];
互联网上有很多视差滚动教程。尝试使用正确的术语进行搜索。这是给你的: