-2
#import "MainScene.h"
static const CGFloat _scrollSpeed = 80.f;
@implementation MainScene {
CCSprite *_hero;
CCPhysicsNode *_physicsNode;
CCNode *_ground1;
CCNode *_ground2;
NSArray *_grounds;
}
- (void)didLoadFromCCB {
_grounds = @[_ground1, _ground2];
}
- (void)update:(CCTime)delta {
_hero.position = ccp(_hero.position.x + delta * _scrollSpeed, _hero.position.y);
_physicsNode.position = ccp(_physicsNode.position.x - (_scrollSpeed *delta), _physicsNode.position.y);
// loop the ground
for (CCNode *ground in _grounds) {
// get the world position of the ground
CGPoint groundWorldPosition = [_physicsNode convertToWorldSpace:ground.position];
// get the screen position of the ground
CGPoint groundScreenPosition = [self convertToNodeSpace:groundWorldPosition];
// if the left corner is one complete width off the screen, move it to the right
if (groundScreenPosition.x <= (-1 * ground.contentSize.width)) {
ground.position = ccp(ground.position.x + 2 * ground.contentSize.width, ground.position.y);
}
}
}
@end
if (groundScreenPosition.x <= (-1 * ground.contentSize.width)) {
我有這樣的2個問題
- 預期表達
- 使用未聲明的標識符 'LT' 的
那是我的問題
個貸款機構幫助我,我真的需要它之前可能
用'<'替換'<'? – Polynomial