Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StateMachineEvent giving me an error #1

Closed
ryanprice opened this issue Jan 11, 2010 · 4 comments
Closed

StateMachineEvent giving me an error #1

ryanprice opened this issue Jan 11, 2010 · 4 comments

Comments

@ryanprice
Copy link

I don't know much about State machines, this is my first attempt at working with them. Your classes looked clean, so thought I would try them out.

when I ran the code after creating a simple stateMachine I was getting an error saying it could not convert StateMachineEvent into StateChangedEvent

so in the StateMachineEvent.as I changed

public class StateMachineEvent extends Event

to

public class StateMachineEvent extends StateChangeEvent
and I don't get an error anymore.

I am using Flex SDK 3.4.1.

Do you have any feedback about what I am doing wrong, or if what I did was really needed. I have only touched the surface of your code, as I said, I am a beginner of these concepts, and mid-level with as3. Thanks for sharing this code, looking forward to making it a foundation in my game.

@cassiozen
Copy link
Owner

Hi Ryan,

It's good to hear you're using StateMachines. Your feedback is appreciated.

Could you please show me the code you used to create de State Machines, so I can take a look and fix any other possible bugs?

@ryanprice
Copy link
Author

Sure, here is an example:

   var zombieSM:StateMachine = new StateMachine();
        zombieSM.addState("birthing",{ enter: onBirthingEnter});
        zombieSM.addState("normal",{ enter: onNormalEnter, from:"birthing,food_normal_transition"});
            zombieSM.addState("food_seeking",{ enter: onFoodSeekingEnter, from:"normal"});
            zombieSM.addState("food_normal_transition",{ enter: onFoodToNormalTransitionEnter, from:"food_seeking"});
            zombieSM.addState("dead",{ enter: onDeadEnter, from:"normal,food_seeking,food_normal_transition"});

            zombieSM.initialState = 'birthing';

I am now starting to use this class all over my app, it's helping me keep things organized and think more clearly. I have still barely scratched the surface of this class, I am now looking into the transition stuff and the hierarchical ability.

@cassiozen
Copy link
Owner

Anything new for you?

@ryanprice
Copy link
Author

Check out the live game at http://apps.facebook.com/zombie_pets/

cassiozen added a commit that referenced this issue Feb 2, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants