Book Image

Cocos2d Game Development Blueprints

By : Jorge Jordán
Book Image

Cocos2d Game Development Blueprints

By: Jorge Jordán

Overview of this book

Table of Contents (15 chapters)
Cocos2d Game Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Summary


This chapter has covered how to develop a typical "defend the tower" game, which consists of waves of enemies that try to reach a fortress.

As the robots are idiots, we had to develop a pathfinder algorithm for them to follow on the way to the tower, and we also had to teach them how to keep to the track by moving to the next step.

To defend ourselves from these robot enemies, we raised some watchtowers which we wanted to be placed near the road and kept to neat positions, which is why we have learned how to predefine positions to place nodes.

Our defenses are also idiots, and we had to teach them to recognize enemies that are near to them, so they can start shooting. For this purpose, we created a covered area for each of the defenses, so when an enemy enters this area the defenses start attacking.

To give support to all the checks in the game, we had to share information between enemies and defenses so the defenses know when an enemy they are attacking is out of range or destroyed...