Frage

I have a sprite that is hidden behind a background image. How can I make the sprite go to the front? Code answers would be great.

War es hilfreich?

Lösung

As sangony said, this can be done through the node's zPosition property.

For example, if the background node is called 'bgNode' and the sprite is 'spriteNode'

bgNode.zPosition = 0;
spriteNode.zPosition = 1;

This will render the spriteNode over top of the bgNode. This is assuming they share the same parent node.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top