我反复从上到下垂直滚动。但是,在 iPhone5 上存在一些滞后问题。
如何让它在 iphone 5 上顺利运行
这是代码:
-(void)scrollBackground:(ccTime)dt
{
CGSize s = [[CCDirector sharedDirector] winSize];
CGPoint pos1 = mBG1.position;
CGPoint pos2 = mBG2.position;
pos1.y -= MM_BG_SPEED_DUR;
pos2.y -= MM_BG_SPEED_DUR;
if(pos1.y <=-((s.height*0.5f) ) )
{
pos1.y = (pos2.y + mBG2.contentSize.height) ;
}
if(pos2.y <=-((s.height*0.5f) ) )
{
pos2.y = (pos1.y + mBG1.contentSize.height) ;
}
mBG1.position = pos1;
mBG2.position = pos2;
}