
上QQ阅读APP看书,第一时间看更新
Fine-tuning gravity
Before we test out our new flying code, we need to make one adjustment. The default gravity setting of 9.8 feels too real. Pierre lives in a cartoon world; real-world gravity is a bit of a drag. We can adjust gravity in the GameScene
class; add this line at the bottom of the didMove
function:
// Set gravity self.physicsWorld.gravity = CGVector(dx: 0, dy: -5)