

This will be useful for responding to collisions as well as letting objects add their own sprites to the drawing area. gameLayer: Simply a reference to the main game layer.This will be the sprite/image object used to draw _this_ object. sprite: Every object in the game will need something to visually represent it.I'll go into detail about the methods when I show you the implementation. is a brief description of each of the properties in here. (id)initWithGameLayer:(GameLayer *)layer #import GameObject : retain) CCSprite (nonatomic, assign) GameLayer CGPoint position This will save us some redundant code in the future.Ĭreate a new file called GameObject.m and, in the header file, write the following code: We are going to use that same idea and create what I'm calling sprouts.īefore we can begin talking about any of the "in-game objects", we need to define a superclass that will contain some of the common methods and properties that every object will need. In the traditional version of the centipede game, mushrooms were you used to define the play area of the centipede. Today, I will go into more detail about setting up the user interface for the game as well as drawing the game board. I also showed you how you can prepare your assets using Texture Packer and load them into your game.
BATCH IMAGE RESIZER 2.88 FULL HOW TO
In the first tutorial in this series, I showed you how to download, install, and create a new Cocos2D project. This is the second installment, where you will learn how to setup the game board and populate it with sprites. In this series, we will be recreating the popular Atari game Centipede using the Cocos2D game engine for iOS.
