ios原生游戏开发
static inline CGFloat skRand(CGFloat low, CGFloat high) {
return skRandf()*(high - low) + low;
}
- (void)addRock {
SKSpriteNode *rock = [[SKSpriteNode alloc] initWithColor [SKColor brownColor] size:CG rock.position = CGPointMake(skRand(0, self.size.width),self.size.height-50);
= @“rock”;
rock.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:rock.size];
esPreciseCollisionDetection = YES;
[self addChild:rock];
}
。
。 。
, Sprite Kit
5. didSimulatePhysics
- (void)didSimulatePhysics