Implementing AS 2.0 with FSM?

Posted by Up2u on Game Development See other posts from Game Development or by Up2u
Published on 2012-07-05T14:36:38Z Indexed on 2012/07/05 15:24 UTC
Read the original article Hit count: 228

Filed under:
|
|

i have seen many of references of AI and FSM like : http://www.richardlord.net/blog/fini...n-actionscript

and sadly im still can't understand the point of the FSM on AS2.0 is it a must to create a class of each state ?

i have a project of game and also it has an AI, the AI has 3 state n i said the state is distanceCheck, ChaseTarget, and Hit the target,

the game that i create is FPS game and play via by mouse

so what i mean is i have create an AI ( and is success ) but i want to convert it to FSM method ...

i create : function of CheckDistanceState() and in that function i have to locked the target with an array, and sort it with the nearest distance and locked it and it trigger the function ChaseState(), and in the ChaseState() i insert the Hit() function to destroy the enemy,

the 3 function that i created , i call it in the AI_cursor.onEnterframe, ( FPS game that only have a cursor in stage )

is there any chance to implement FSM to my code without to create a class ?? from what i read before , to create a class mean to create an external code outside of the frame ( i used to code in frame) and i stil dont understand about it.

sorry if my explaination not clear ...

© Game Development or respective owner

Related posts about programming

Related posts about ai