state machine with HGE 2D games engine.