4. Simple Collision Detection and the First Enemy

In the previous chapter you learned the basics of Cocos2D animations and actions. You also started building a flexible framework for Space Viking. In this chapter you go further and create the first enemy for Ole to do battle with. In the process you learn how to implement a simple system for collision detection and the artificial intelligence brain of the enemies in Space Viking.

There is a significant amount of code necessary in this chapter to drive the behavior of Ole and the RadarDish. Take your time understanding how these classes work, as they are the foundation and models for the rest of the classes in Space Viking.

Ready to defeat the aliens?

Creating the Radar Dish and Viking Classes ...

Get Learning Cocos2D: A Hands-On Guide to Building iOS Games with Cocos2D, Box2D, and Chipmunk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.