Renoki: Making An Android Game (part 4)
My First Big Step
I worked on Renoki a lot this weekend. This was a combination of Allison being gone and the HoN servers being under attack from a DDOS making games unstable. Regardless, I managed to get a monster loaded and the door animations working. And yes you can faintly hear the radio station playing annoying Miku Hatsune in the background.
Anyway, I set up my framework exactly how I described it in one of the earlier parts. There is a loop that runs continuously that continually draws sprites to a screen and also updates their state. There is an array of sprites, with each index corresponding to one of the nine locations on the game board. For now, it just inserts sprites at constant rate, whereas in the future it will be random and dependent on the level speed.
The animations are done by using sprite sheets. This is where I take five frames of an animations and just paste them one after another onto one big image. After you load the combined image, you create a viewable rectangle that only shows one of the frames. Then, you just shift the rectangle over 1 frame at a time and that creates the moving animation.
The monster object is completely independent of the rest of the framework. By this, I mean that the monster controls the door open and close animation and how long it stays on the gameboard. Once the monster decides it is dead or retreats, it sets a flag and the loop will remove it from the array.