How can I parse Sprite to Layer?

How can I parse Sprite to Layer?
Thanks a lot~

Do you mean: how do I make a Sprite into a Layer?

If so, the answer is: a Sprite is a Layer. You’ll see that the JavaDoc documentation for Sprite says that it ‘extends’ Layer. In object-oriented programming terms, Sprite is a subclass of Layer; Layer is the superclass of Sprite. So this means that you can use a Sprite anywhere you should use a Layer. For example:


Sprite sprite = new Sprite(image, width, height);
Layer layer = sprite;  // no problem, sprite is a Layer
layerManager.append(sprite);  // no problem either