xcode“使用未声明的标识符”

时间:2014-03-04 18:30:10

标签: xcode

#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)) {

我有这两个问题

  • 预期表达
  • 使用未声明的标识符'lt'

这就是我的问题

plis帮助我,我真的需要它可能

1 个答案:

答案 0 :(得分:0)

无论您从何处复制代码,其百分比转义为小于号码,因此它会放入&lt;而不是<。因此,只需将&lt;替换为<