Now we have a world to run around in and bullets to shoot, but nobody to stop us from reaching our goals. We need to add some enemies to spice it up. As we go through the enemy handling code, keep in mind how we set up the hero. You will see a lot of similarities, and we could have compressed them into a single base class, but opted not to do so for clarity's sake.
+(id) enemyAtPos:(CGPoint)pos onLayer:(TDPlayfieldLayer*)layer { return [[[self alloc] initForEnemyAtPos:pos onLayer:layer] autorelease]; } -(id) initForEnemyAtPos:(CGPoint)pos onLayer:(TDPlayfieldLayer*)layer { if((self = [super init])) { // Keep a reference to the layer parentLayer = layer; // Build the sprite [self buildEnemySpriteAtPos:pos]; // Add the sprite to the layer [parentLayer addChild:sprite z:2]; // Set the max shooting speed ...