Saturday was very productive for me. I re-did the input layer to support multi-touch. Now you can play more than one note at a time on the virtual piano portion of the game. I’m not sure it’s 100% right, and there seems to be occasions where the key gets “stuck” in the down position. I’ll have to debug that before release. I also added labels to the keys for those that don’t know the notes on a piano. I actually implemented the labels with an AtlasSpriteManager and AtlasSprites. The way it works is that you compound multiple sprites in a single texture (one png file for me), and set the sprites to be different regions of the shared texture. This allows it to load the texture once, draw all the sprites, and then move on to the next texture.
The static labels aren’t where AtlasSprites really shine, the best use of them is for animations. I added a pulsing gate that “kills” the notes that make it past the player. I started with a png file containing all the animation frames:

Here’s the code to make the it pulsate:
Texture2D *killerTexture =
[[TextureMgr sharedTextureMgr] addImage:@"killer.png"];
killerManager =
[[AtlasSpriteManager alloc] initWithTexture:killerTexture capacity:9];
AtlasSprite *ks =
[killerManager createSpriteWithRect:CGRectMake(0, 0, 32, 134)];
[ks setPosition:ccp(wallLocation, STAFFSPACING * 2)];
AtlasAnimation *animation =
[AtlasAnimation animationWithName:@"pulse" delay:0.1f];
for(int i = 0; i < 9;i++)
{
[animation addFrameWithRect: CGRectMake(i*32.0, 0.0, 32, 134)];
}
for (int i = 8; i > 0; i--)
{
[animation addFrameWithRect: CGRectMake(i*32.0, 0.0, 32, 134)];
}
[killerManager addChild:ks];
[self addChild:killerManager z:5];
id action =
[RepeatForever actionWithAction:
[Animate actionWithAnimation: animation]];
[ks runAction:action];
Basically, you load the texture, create a atlas sprite manager with the texture, create a sprite in that manager, and then build an animation based on the different portions of the texture. One thing to note is that creating a sprite with the AtlasSpriteManager’s createSpriteWithRect message does not add it to the manager. You still need to do that yourself. Also note that you don’t add the AtlasSprite to the layer/scene, you only add the AtlasSpriteManager which handles drawing all of the child sprites. The animation is pretty straight forward, just add the individual frames, set the delay, and you’re off. In this example I add the frames going forward, and then going backwards.
I did start out with only five frames, but it was choppy on the actual device, so I expanded it to nine frames and it’s smooth as butter.