How to make a sprite jump to a specific height with SpriteKit?

后端 未结 2 1942
时光取名叫无心
时光取名叫无心 2020-12-31 20:00

I am trying to use applyImpulse to make a sprite jump to a specific height. In the example code below, the dynamic black circle jumps to the same height as the static red ci

2条回答
  •  感情败类
    2020-12-31 20:42

    Instead of applyImpulse use velocity. Velocity will be more specific. jumpingCircle.physicsBody?.velocity = CGVectorMake(jumpingCircle.physicsBody.velocity.dx, 300.0f); Code not tested.

提交回复
热议问题