Implementing a FSM with ActionScript 2 without using classes?
- by Up2u
I have seen several references of A.I. and FSM,
but sadly I still can't understand the point of an FSM in AS2.0.
Is it a must to create a class for each state?
I have a game-project which also it has an A.I.,
the A.I. has 3 states: distanceCheck, ChaseTarget, and Hit the target.
It's an FPS game and played via mouse.
I have created the A.I. successfully, but I want to convert it to FSM method...
My first state is CheckDistanceState() and in that function I look for the nearest target and trigger the function ChaseState(), there I insert the Hit() function to destroy the enemy,
The 3 functions that I created are being called in AI_cursor.onEnterframe.
Is there any chance to implement an FSM without the need to create a class?
From what I've read before, you have to create a class. I prefer to write the code on frames in flash and I still don't understand how to have external classes.