我正在尝试将CGPoint位置分配给SKEmitterNode
// Add the explosive emitter
var pos = CGPointMake(gs.frame.size.height / 2, gs.frame.size.width / 2);
var fireEmitterPath = NSBundle.mainBundle().pathForResource("Fire", ofType: "sks");
var fireEmitter = NSKeyedUnarchiver.unarchiveObjectWithFile(fireEmitterPath!);
fireEmitter?.position = pos; // ERROR HERE
fireEmitter?.runAction(SKAction.sequence([SKAction.waitForDuration(0.2), SKAction.scaleBy(1.5, duration: 0.1), SKAction.runBlock({
fireEmitter?.particleBirthRate = 0;
})]))
// add the smoke emitter
var smokeEmitterPath = NSBundle.mainBundle().pathForResource("Smoke", ofType: "sks");
var smokeEmitter = NSKeyedUnarchiver.unarchiveObjectWithFile(smokeEmitterPath!);
smokeEmitter?.position = pos;
gs.addChild(smokeEmitter);
smokeEmitter?.runAction(SKAction.sequence([SKAction.waitForDuration(0.2), SKAction.scaleBy(1.2, duration: 0.2), SKAction.runBlock({
smokeEmitter?.particleBirthRate = 0;
})]))
分配emitter.position时,我收到编译错误:
对成员'位置'
的模棱两可的提及
任何意见都赞赏。