Animation, AI and the projectile.

3_12_2015This weeks blog post will be about iterations that i have made on the AI for the enemies and projectile that the player will be able to fire to knock back enemies(described in a previous blog post).

I am currently working on the animation on the towers. The reason to why this has been a bit more difficult then I imagined is because of the way the combat currently works. And for the animations to be a lot easier to implement I would have needed to implement a finite state machine for the towers. This will probably be done towards the final of the project. Since a proper state machine will be necessary for both the enemies and the towers. The reason behind this is that the code gets complex really fast. A proper explanation to why this is a recommended way to control AI and animation is found here, other things as states for the player movement are recommended aswell. http://gameprogrammingpatterns.com/state.html

The problem itself in the animation is caused because each plant checks if it collides into each enemy. So i cannot change the animation if it collides into a enemy since then it will reset each time a new enemy collides into it. Also, i cannot set the animation for the plant to be static each time a enemy does not collide into it. So i need to add functions that checks if no enemy collides and if a enemy collides. So that it does not reset all the time. This is a real pain to do without the finite state machine since it results in a vast amount of ifs, else and else ifs.

The other thing i have been working on is the projectile, and sadly it is still not finished. The positive thing is that the projectile travels correctly toward the position of the mouse.

The current problem with it is that it is some logical problem that is in the code. It travels correctly, and once it returns to the player its position does not get updated correctly. So once you fire again the projectile spawns at the point of where it left of the last time. This will probably not be so difficult to fix, when i get the time to fix it.

The main problem overall with the coding is that I am working on everything at the same time. There are still a vast amount of glitches to be fixed, and so much art that I have not had the time to implement.

About Gabriel Ajuwa

2014  Programming