Better way to do AI Behavior in AS3/Flixel

Posted by joon on Game Development See other posts from Game Development or by joon
Published on 2012-09-23T22:48:38Z Indexed on 2012/09/24 3:51 UTC
Read the original article Hit count: 342

Filed under:
|

I'm making a game in Flixel and I need to program an NPC. It's rapidly turning more complex than I expected. I was wondering if there are any best practices, tutorials or examples that you can refer me to, to see how this is done.

I can probably hack it together, which is what I always do, but it would be nice if I can make it maintanable and can add stuff later on.

Here's screenshot to give you an idea: The butler will be an NPC that will follow you, or guide you, and talk to you the whole time.

enter image description here

EDIT: More specifically: What I have now is a long list of IF statements in the update loop of the butler (about 8 different cases), and all I have covered is his walking behavior. I want him to comment on things and sometimes switch his main behavior to be more aggresive or distant,... Is there any way to keep track of this, or is complex code with many many nested if statements the way to go?

© Game Development or respective owner

Related posts about ai

Related posts about npc