我在 Xcode 中使用 Sprite Kit,我想更改在重力上设置的默认值。这是我的代码:
SKSpriteNode *sprite = [SKSpriteNode spriteNodeWithImageNamed:@"sprite1.png"];
sprite.position = CGPointMake(-100+CGRectGetMidX(self.frame), 50 + CGRectGetMidY(self.frame));
[self addChild:sprite];
sprite.color = [SKColor blueColor];
sprite.colorBlendFactor = 1.0;
sprite.xScale = 0.2;
sprite.yScale = 0.2;
[SKPhysicsBody bodyWithCircleOfRadius:50];
sprite.physicsBody.dynamic = YES;
sprite.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:sprite.size.width * 0.5];
现在我知道使用这行代码应该提供默认设置,但我现在无法运行该项目:
//self.physicsWorld.gravity = CGPointMake(0.0, -9.8);
帮助?