i hope i'm not missing something.I'm trying to run SKAction on my SKShapeNode inside my update method , i made a flag check that i will only enter once to the "if" statment , it's working on the DidMoveToView method but dosent on the update or in the DidSymulatedPhyisics Method, any ideas why? My Node : // created path before works fine
var step = SKShapeNode(path: pathtodraw2)
step.fillColor = SKColor.whiteColor()
step.position = CGPoint(x: 0, y: self.frame.midY)
step.physicsBody = SKPhysicsBody(edgeChainFromPath: pathtodraw2)
step.physicsBody?.affectedByGravity = false
step.physicsBody?.dynamic = true
self.addChild(step)
SKaction :
var movedown = SKAction.moveToY(324, duration: 5)
step.runAction(movedown)
UPDATE : i even removed it from the if statment and put the SKAction in the top of the update method m and still dosent work . and i place it in thr didMoveToView it's working, no clue why The full update method :
if abs(circle.physicsBody!.velocity.dx) < 5 && abs(circle.physicsBody!.velocity.dy) < 5 && ismoved == true //check if the object stopped moving (not the one im trying to move down)
{
ismoved = false
circle.physicsBody?.velocity = CGVectorMake(0, 0)
self.userInteractionEnabled = true
if circle.position.y > 100 && falloff == false { //checking if the second object above the first object **working fine used breakpoint* and it enter inside the statment
println("asd" )
var movedown = SKAction.moveToY(324, duration: 5) //trying to move it down
step.runAction(movedown) //trying to move it down
falloff = true
}
}
if abs(circle.physicsBody!.velocity.dx) > 1.4 && ismoved == false{ //check if the object start moving (not the only im trying to move down)
ismoved = true
}