Implementing a FSM with ActionScript 2 without using classes?
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
21:25 UTC
Read the original article
Hit count: 289
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.
© Game Development or respective owner