SpriteKit-创建一个计时器
@implementation MyScene{ int counter; BOOL updateLabel; SKLabelNode *counterLabel;}-(id)initWithSize:(CGSize)size{ if (self = [super initWithSize:size]) { counter = 0; updateLabel = false; counterLabel = [SKLabelNode labelNodeWithFontNamed:@"Chalkduster"]; counterLabel.name = @"myCounterLabel"; counterLabel.text = @"0"; counterLabel.fontSize = 20; counterLabel.fontColor = [SKColor yellowColor]; counterLabel.horizontalAlignmentMode = SKLabelHorizontalAlignmentModeCenter; counterLabel.verticalAlignmentMode = SKLabelVerticalAlignmentModeBottom; counterLabel.position = CGPointMake(50,50); // change x,y to location you want counterLabel.zPosition = 900; [self addChild: counterLabel]; }}
萧十郎
森林海