Renoki: Making An Android Game (part 8)
We finished moving into our new apartment, which involved a large number of boxes. Along with those boxes was a lot of Ikea furniture that required assembly. As such, I didn’t have much time to work on Renoki.
I did a significant amount of code cleanup. I also added several new monsters. There is basic2, which is basic1 but with more health. This was trivial as I just changed the health of the basic monster. I added the bomb, which was also trivial. All monsters do damage to the user when you hit them, with regular monsters dealing 0 and bombs doing damage. Finally, I implemented the number monster. The number monster appears with a number on him, requiring you to hit the corresponding numpad location rather than the monster himself.
In order to do the number monster, I had to use two arrays. One array contains what each position owns. Thus, if a number four monster appeared in position one, I would put a 1 in index 4. The second array contains what each position is owned by. For the same situation, I would put a 4 in index 1. Then, when you touch a position, you first check these two arrays. In the event of ownership, you must change where the hammer animation appears and what position actually gets hit.
I made another decision to simplify code. Every X frames, you insert a monster at a random location. If that location is occupied, you just don’t insert for that turn. Similarly, since multiple number monsters cannot own or be owned by more than one number monster, duplicate ownership will just cause the insert to fail. I was considering making it keep generating random numbers until it finds a match, but I realized that this adds nothing to the game while simultaneously increasing the delay of calculation. Since everything is random anyway, having random failures to insert monsters are fine. I can always offset this by increasing the speed at which monsters are inserted.
In addition, Allison started to work on it as well. She wrote up the menus and buttons, as well as the start screen animations where the clouds scroll by and the monster blinks. She is going to start working on the shop soon.
Kitten Health
Hey, great blog. friend is talented guy. i would like to read more.