O'Reilly logo

Learning iOS 8 Game Development Using Swift by Siddharth Shekar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Physics

In other frameworks, you will most probably have to import a physics engine library of your choice, such as Box2d, or chipmunk would configure it to make it work properly. You would also have to write custom code for making collision detection work. In SpriteKit, every scene has physics running in the background as soon as the scene is created. You are not required to do anything else to make it work. So, in the gameplay scene, we will disable the physics engine we created and replace it with SpriteKit's inbuilt physics engine.

Open up the gameplayScene.swift file and comment out the updateHero function in the update function. As you might remember, the updateHero function took care of making the hero get affected by gravity, making sure ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required