Javascript State Machine

Wed, Jun 1, 2011

This image is a sneak peak at my next little javascript experiment, moving up a level from Pong, yes its breakout!

It turns out breakout is just complicated enough to need a little more structure than pong. With a game loop that includes multiple modes for the menu, playing the game, winning, losing, changing levels, its a perfect opportunity for a little finite state machine.

Even though the breakout game is not quite ready for prime time, I am quite happy with the state machine abstraction so I took a little time out to package it up as a nice little standalone javascript micro-framework.

Full install and usage instructions are on github

Enjoy!

UPDATE: you can see how I ended up using the state machine in breakout here.