Game Development Reference
In-Depth Information
nodeB.removeFromParent()
}
}
The new didBeginContact() increases the impulseCount property each time the
player comes into contact with an orb and then removes the orb. Now the player has addi-
tional fuel to keep from crashing into the planet's surface below.
To see this change in action, save your changes and run the game again. This time when
you tap the screen, the player will be thrust upward and hit the first orb, then hit the
second, and so on, until it flies off the top of the screen. If you tap long enough, the player
will eventually run out of impulses and fall back through the bottom of the game.
Scrolling the Scene
In this section you are going to start adding movement to your game world. Before mak-
ing any additional code changes, go back to Xcode and select the first background image
in the Images.xcassets folder (Arrow 1), as shown in Figure 4-2 . With the first
background selected (Arrows 2 & 3), expand the Utilities section of Xcode (Arrow 4) and
then click the Show Attributes Inspector button (Arrow 5). Notice the Image properties
(Arrow 6). The height of the image is much greater than any of the currently available
devices (Arrow 6).
Figure 4-2 . The background image size
Search WWH ::




Custom Search