Click to Play!

Tuesday, September 9, 2014

Organizing Enemy Code (Unicorn Training vs Future)

I should keep a comment list of all methods before the first one starts.
I can find them easier that way.
     One of the things I need to keep in mind for future projects is the way I write AI code. I need to organize things into very specific methods to minimize copy/paste lines of logic and everything needs to be placed in a way that makes looking for a particular method easy. I think I did pretty well with Unicorn Training, especially compared to how I started with TriGrid.

     All the enemies have similar behavior methods organized in the same way. The AimAtPlayer() method is always after the NearPlayer() method and before the Knockback() method. Over time I'm getting better at writing clean code because I'm learning what my needs as a designer are. It'll be interesting to see how my way of thinking changes when I switch to turn-based AI code next year.

No comments:

Post a Comment