XNA Game Dev Blog #5
2011
05.17
XNA Game Dev Blog #5
Category: Uncategorized / Tags: no tag / Add Comment
Well I got animations working, both looping and non looping. It was surprisingly easy. All I needed to do was create a rectangle bound of the current section of the texture I want to draw, then every iteration where current game time – past game time > next frame, add on the sprite width to the bounds X axis. Here’s another animated gif of it working: Left is a non looped animation, right is looped.
This is the animation sprite sheet used: I put a red border on the edge of each sprite. 64×64 for each section.
You’ll also notice that the alien space ships move slightly different to previous posts too. A lot less predictable than before, for the better. Implementing the current objects to have animations is rather simple too. The animation class derives from the baseObject class, and if needs be I can just make my current object classes inherit from the animation class, add in the extra arguments and it’s done; everything will still work as before.
The next task is to add explosions for when a ship blows up. Then perhaps upgrades. After that probably move onto extra enemies, then scoring.