Chapter 14. Next steps

Now that you have completed this book, we would like to leave you with suggestions on where you can go next. Remember, we keep our version of Pencil Adventure online at GitHub, ready for you to fork and work on yourself. We are happy to receive your feedback, questions, or even bug reports in the issue tracker.

In summary, we have covered the following Swift topics:

1. Introduction to Swift

We discussed the language features and created a knowledge foundation for use throughout the book. We also provided you with a basic reference for the Swift language.

3. Introduction to Sprite Kit

This chapter was where we started the game development. We learned how to create a project in Xcode. We saw how a View Controller works, how to create the Game Scene, and why sprites are good building blocks for a game.

4. Platform game

In this chapter, things started getting more scientific because we discussed the physical properties of the game, how thinking of the game as real world is highly beneficial, and how Sprite Kit works by applying forces such as gravity and how you can apply physical impulses to the sprites in your scenes, making them move.

5. Adding more platform features

The previous two chapters came packed with a lot of information on how to get your game off to a good start. In this fifth chapter, we learned how private functions and downcasting types work, as well as some advanced bit magic using the bit shifts and logical bitwise operators, useful for some Sprite Kit related techniques.

6. Level select scene

Now that we had created a game scene, adding a couple of sprites and physics components, including our hero and his ability to jump, this chapter dealt with the level select scene. We learned how to create a Sprite Kit scene by programmatically adding nodes and sprites. We gave a small and formal introduction to the object-oriented programming pattern in Swift, we also discussed loops, string interpolation, and optionals. Last but not least, we also took a brief look at how you can run threaded code in Swift, so to not block the important main User Interface thread.

7. Creating levels

In this chapter, we discussed how you would go about adding more levels to your game. We saw how the Level Editor works in Xcode. Strictly in terms of Swift, we looked at more elaborate function definitions, such as creating a function with a return value, and we also discussed the enumerated .None value that is a part of any optional type, and is important when checking that an optional actually contains a real value. 

8. Adding our hero life line

As we keep expanding your knowledge of Swift, this chapter was where we taught you about convenience initializers, another part of the Swift object-oriented programming pattern. These special initializers, commonly known as constructors, let you create multiple ways of creating your object. We also looked at the special SKCropNode class that is a special node in Sprite Kit that lets us progressively display more or less of a node to indicate progress, such as the current health of our hero Steve Stencil. We also discussed protocols, which is how you define how Swift classes interface with each other.

9. Saving scores

Here we talked about how you can use Swift to persistently store values from the game using NSUserDefaults. We also showed you how you can use GameKit to integrate with Apple’s Game Center, and specifically how to create a leaderboard for your players.

10. Adding sound effects

There is no such thing as a game without sound effects, which is why in this chapter we used the AVAudioPlayer and SKAction classes to effectively play sounds, not just in the background, but as a result of something happening in the Pencil Adventure game.

11. Adding visual effects

In this chapter, we showed you how to create a simple particle effect in Sprite Kit that involved the SKEmitterNode class. 

12. Advanced game topics

In this chapter, you learned about how to manage art assets and how to tackle the world of pixels using vectors, a bit of trigonometry, and some problem solving skills. You also learned techniques for improving game performance.

Change existing levels

Here are some suggestions for modifying the game to further your learning. The first thing we suggest you do is to change the design and layout of one of the existing levels. Become familiar with the Xcode level designer and make sure you get the hang of how the designer plays together with the actual code in the game scene class.

New levels

Adding a new level or two with your own artwork and design is the ultimate proof that you know how to create a game for iOS using Swift. Doing this will ensure that you know and have understood the principles of Sprite Kit and that you are proficient in Xcode.

Restart level button

We did not include a restart level button in the Game Over scene. So, it is up to you to add it! Follow the examples on how to create a sprite with specific artwork that could represent a restart button, and add it in. Then override touchesBegan to perform the restart. We think it would be easiest if you just instantiate a new level and present it instead of trying to re-use any scenes.

Dr. Evil

You might have noticed that while we told you that every game must have not only a protagonist, in our case the amazing Steve Stencil, but also an antagonist, we did not add an antagonist to Pencil Adventure. This was not a short sight on our side, but rather, we merely wanted to leave something for you to implement on your own. We suggest you create a new level where Steve has to destroy Dr. Evil, an evil marker who kidnapped Princess Paperclip. An interesting game play here could be that Steve would have to jump on top of Dr. Evil and not miss him while Dr. Evil moves around.

Farewell

Remember that Pencil Adventure is also your game. You can make any changes that you want. Be creative, have fun, and explore your ideas. Stay in touch with us at GitHub and show us your changes!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset