swift - SKAction sequence is not delaying the spawnning of my nodes -


i'm using skaction sequence delay spawning of nodes under circumstances. when lanefire true not want delay happen. if else want delay happen. created skaction called spawnaction. inside spawnaction added child. put spawnaction inside sequence. put after waitaction in sequence in order create delay before node spawns. however, spawning of node not delayed. spawns on screen , waits 1.5 seconds before performing moveaction.

also, mouse! skspritenode() , movingobjects skspritenode()

var action = skaction()     let spawnaction = skaction(movingobjects.addchild(mouse!))     let actiondone = skaction.removefromparent()      if lanefire == true     {         action = skaction.movetoy(self.size.height, duration: duration)      }     else     {          let waitaction = skaction.waitforduration(1.5)         let moveaction = skaction.movetoy(self.size.height, duration: duration)         action = skaction.sequence([waitaction, spawnaction, moveaction])      }// end of lanefire if statement      mouse!.runaction(skaction.sequence([action, actiondone]))      mousecount++ 

the following line suspicious (i'm not sure why compiler accept it)

let spawnaction = skaction(movingobjects.addchild(mouse!))

if mouse isn't hidden, added to moving objects node , appear before action executed.

if make mouse node hidden, make spawnaction unhide() :

mouse!.hidden = true movingobjects.addchild(mouse!) let spawnaction = skaction.unhide() ... 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -