Topic was automatically imported from the old Question2Answer platform.
Asked By
Ben Nicholl
I’m creating an ice hockey game with a birds eye view. My node setup right now for what my player skates on is
Node2d
ParallaxBackground
TextureRect
Where TextureRect holds the image of the ice hockey rink that my player would skate on. My question is, is this the best way to create an object that my player will move on?
As long as you’re not interested in a parallax effect: no. These are commonly used in 2D-Sidescrollers to create a sense of depth, but for a top-down game you most likely won’t need it. So you can directly use the TextureRect, no need for a ParallaxBackground.
If I only use a TextureRect, my hockey player, puck, etc are not visible over the hockey rink sprite. When I use a parallaxBackgorund, my hockey player, puck etc, are visible over the hockey rink sprite
Ben Nicholl | 2020-02-17 22:52
If the player, puck, etc. are children of the TextureRect that shouldn’t be the case! Unless the “z”-property is lower than zero (you can check that in the inspector), in which case you can simply set it to a higher value to make it visible again.
If not, you can check the “Show Behind Parent”-property for the TextureRect. However, the real question you should ask yourself here is: Why is the background a child of the player and not vice versa? For the ParallaxBackground this does not happen, because it’s “Layer”-property is set to -100 by default.
It sounds like you’re working on a game development project and you’re currently setting up the nodes for the player to skate on in your ice hockey game. Can you provide more details on your current node setup? This will help me better understand your project and provide more relevant advice.
As long as you’re not interested in a parallax effect: no. These are commonly used in 2D-Sidescrollers to create a sense of depth, but for a top-down game you most likely won’t need it. So you can directly use the TextureRect, no need for a