swift - How to detect if SKAction is running -


this skaction:

 naarrechts  = skaction.movetox(positionx , duration: 0.22) player.runaction(naarrechts) 

in duration of 0.22 sec not want action run:

    if cgrectintersectsrect(player.frame, car.frame){         player.position.x = car.position.x     } 

what magic line of code can detect if first skaction running, or detect wether player in movement or not..

you can create class variable var playerisinaction = false set true after run action. change method can write completion code (after action ends) set bool false.

it should :

playerisinaction = true player.runaction(naarrechts, completion: {() in      playerisinaction = false }) 

and check bool

if cgrectintersectsrect(player.frame, car.frame) && playerisinaction == false {     //code } 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -