0
我正在嘗試unhide
此節點,以便它出現在rect
位置內,但隨後又以某種方式再次使該節點hidden
處於脫機狀態,因此當它位於rect
內的不同位置時。但我試圖隨機添加一個隨機定時器unhides
(但不到5秒)?節點的新位置
let x12 = rect4.origin.x + CGFloat(arc4random()) % rect4.size.width
let y12 = rect4.origin.y + CGFloat(arc4random()) % rect4.size.height
let randomPoint12 = CGPointMake(x12, y12)
self.yellowcircle3.position = randomPoint12
self.addChild(yellowcircle3)
yellowcircle3.hidden = true
我建議你使用,而不是'NSTimer'的'SKAction'。這是爲什麼http://stackoverflow.com/questions/23978209/spritekit-creating-a-timer – 0x141E
我可以做到這一點與多個節點? – MattB
@MattB格式與多個節點相同。您只需要爲每個節點分別定義多個定時器,例如myTimer1和myTimer2 –