Add getSpriteId method for CompositeSprite

Modified code from pull request #190