Book Image

Python Game Programming By Example

Book Image

Python Game Programming By Example

Overview of this book

Table of Contents (14 chapters)
Python Game Programming By Example
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 2. Cocos Invaders

In the previous chapter, we built a game with a Graphical User Interface (GUI) package called Tkinter. Since it is part of the Python's standard libraries, it was easy to set up the project and create the required widgets with a few lines of code. However, this kind of module falls short of providing the core functionality of game development beyond the 2D graphics.

The project covered in this chapter is developed with cocos2d. This framework has forks for different programming languages besides Python, such as C++, Objective-C, and JavaScript.

The game that we will develop is a variant of a classical game, Space Invaders. This arcade was a success of its time, and it has become part of the culture of video gaming.

In this two-dimensional game, the player must defeat waves of descending aliens by shooting them with a laser cannon, which can be moved horizontally and is protected by some defense bunkers. The enemy fire attempts to destroy the player's cannon, and it...