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

Adding wall and floor parallax

What is a game without a parallax effect? In SpriteKit, we added parallax using sprites, while in SceneKit, we will use planes to add it to the scene. Apart from adding parallax, we will also see how to add diffuse, normal, and specular maps to the plane. Also, we will learn what those terms even mean.

So, as usual, we create a new function in which we will add all these planes. Add four global SCNNodes as follows:

var parallaxWallNode1: SCNNode!
var parallaxWallNode2: SCNNode!
var parallaxFloorNode1: SCNNode!
var parallaxFloorNode2: SCNNode!

Also, add a function to the scene called addWallandFloorParallax as follows:

 func addWallandFloorParallax(){ //Preparing Wall geometry let wallGeometry = SCNPlane(width: 250, height: ...

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