SKSpriteNode添加时不显示



我使用的是Objective-C和SpriteKit。我制作了一个简单球的SKSpriteNode,然后添加它。不幸的是,它没有显示。

-(void)didMoveToView:(SKView *)view {
/* Setup your scene here */
// Set background color
self.backgroundColor = [SKColor whiteColor];
// Creating a new spritenode from an image
SKSpriteNode *ball = [SKSpriteNode spriteNodeWithImageNamed: @"ball"];
// Add the sprite node to the scene
[self addChild: ball];

你忘记设置精灵的位置了吗?

ball.position = CGPointMake(CGRectGetMidX(self.scene.frame), CGRectGetMidY(self.scene.frame));

最新更新