-1

How can I go about approaching this? I want to turn off isDyanmic after my sprite has approached a certain position. So basically how do I do something after something has occurred in swift?

Thanks in advance

phindle
  • 73
  • 5

1 Answers1

0
 override func update(_      currentTime: TimeInterval) {
     //In this case, you can just      change self.size.height/2 with whatever position you want.
     if sprite.position.y <=      self.size.height/

    sprite.physicsBody?.isDynamic = false


}


 }

This should do the trick. In this case, the sprite is falling from on top. Once it reaches the middle, it becomes static.

sicvayne
  • 620
  • 1
  • 4
  • 15