Implemented StateManager and fixes on Sprite class