iPhone - Sprite Not Showing Up Because Background is Hiding It
-
21-12-2019 - |
Question
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.
Solution
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow