Jump to content

Interactive Sprite State Machine Example w/ Demo


aroth
 Share

Recommended Posts

Hello. I stumbled across Phaser last night and created a quick demo that extends a sprite to use a state machine. State and transitional animations are handled automatically. In the past I've used this system for an ImpactJS game where the playable character had 15 states.  In the demo I've included 4:

 

- sitting

- walking

- laying

- sleeping

 

Press the RIGHT key to cycle through the states. The cat will automatically lay and then sleep after a couple seconds if there is no input.

 

 

Perhaps someone will find this useful. 

 

 

Demo:

http://www.adamjroth.com/phaser-extend-sprite-statemachine-example/

 

GitHub Repo:

https://github.com/aroth/phaser-extend-sprite-statemachine-example

 
Screenshot:
8BAbY4L.png
Link to comment
Share on other sites

  • 1 month later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...