Creative Pact Day 2: CatFishTron

Creative Pact Day 2

Creative Pact Day 2

Today I’m going to create more of a “game,” eventually called CatFishTron.  No, really.  I’ll be learning how to add sound to a game, a moving background, and maybe, if I have time, add some self-removing sprites (for explosions, etc!)

First task – to make a sprite “blow-up” in AndEngine you use a SequenceModifier and attach it to the Sprite:

this.mBlowupModifier = new SequenceModifier(new ScaleModifier(1.0f, 1.0f, 0.2f));

final IShapeModifierListener listener = new IShapeModifierListener()
 {
 public void onModifierFinished(IShapeModifier arg0, IShape arg1)
 {
 // this is a function in my main Activity that removes a sprite entity and physics body in a separate thread
 destroySprite(_spriteEvent.mSprite);
 }
 };
 //set a listener to listen for the modification having finished
 this.mBlowupModifier.setShapeModifierListener(listener);
 // attach it to the sprite entity object
 _spriteEvent.mSprite.addShapeModifier(mBlowupModifier.clone());

Here’s today’s code (again, it’s not complete, just building on the previous day, but you might find it interesting…)

Here’s the app itself, you can open the link on your android phone to install it.

It’s a work in progress, remember. It take a bit to make a video game… even a crappy one!

Also, I promise that at the end of this I will write a tutorial.

Now go play MeowTron.