2
我有一個非常艱難的時間,我的精靈節點放置在屏幕的頂部,在精靈之間有相等/近乎相等的空間。精靈顯示,但我不知道如何編寫它的方式,它適用於所有iDevices(iPad除外)。請幫助:)SKSpriteNode定位
SKTexture *ure = [SKTexture textureWithImageNamed:@"enemy"];
SKSpriteNode *temp = [[SKSpriteNode alloc] initWithTexture:ure color:nil size:CGSizeMake(400, ure.size.height)];
CGPoint pos = CGPointMake(70,50);
[temp setPosition: [self convertPointFromView:pos]];
temp.physicsBody.affectedByGravity = NO;
[self addChild:temp];
SKTexture *ure2 = [SKTexture textureWithImageNamed:@"enemy"];
SKSpriteNode *temp2 = [[SKSpriteNode alloc] initWithTexture:ure color:nil size:CGSizeMake(400, ure2.size.height)];
CGPoint pos2 = CGPointMake(170,50);
[temp2 setPosition: [self convertPointFromView:pos2]];
temp2.physicsBody.affectedByGravity = NO;
[self addChild:temp2];
SKTexture *ure3 = [SKTexture textureWithImageNamed:@"enemy"];
SKSpriteNode *temp3 = [[SKSpriteNode alloc] initWithTexture:ure color:nil size:CGSizeMake(400, ure3.size.height)];
CGPoint pos3 = CGPointMake(270,50);
[temp3 setPosition: [self convertPointFromView:pos3]];
temp3.physicsBody.affectedByGravity = NO;
[self addChild:temp3];
如何做到這一點正確,有效,並使其發揮作用? – youngtunechi 2014-09-27 18:27:33