Optimised a bit of Sprite.js