this post was submitted on 15 Dec 2024
69 points (100.0% liked)

Godot

6007 readers
19 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

[email protected]

Credits

founded 2 years ago
MODERATORS
 

If you do this remember to free the old one (or have some way of accessing it) since the engine won't do it for you

top 5 comments
sorted by: hot top controversial new old
[–] [email protected] 5 points 1 week ago (3 children)

@Ategon I knew of this, but have literally never needed it. Do you know of a case where it's useful? Just curious if other people structure their games differently or something.

[–] Ategon 9 points 1 week ago* (last edited 1 week ago) (1 children)

It definitely has more niche use due to the children interactions. Its pretty much just a shorthand for one specific case of function calls you would do so that you dont have to mess with all of reparenting, position, etc. for that case

Its more useful for engine and tool development (and is used in the engine for the change type button when you right click)

Off the top of my head a use case in a game would if for some reason you have placeholders, replacing the placeholder with the actual node. Another one is if your enemies change based on a specific metric in the game (e.g. once a run hits 1 minute all enemies change to be a harder enemy), you can just replace the old enemy node/script with the new one so that you get the updated script (would have to also manage the sprite in that case though)

[–] [email protected] 1 points 1 week ago

@Ategon The placeholders thing makes sense!

[–] popcar2 5 points 1 week ago

Not sure about the context of a game, but I've used this to replace some UI nodes when the game switches to portrait mode on mobile. Sometimes it's just easier to use different containers.

[–] [email protected] 1 points 1 week ago

Using nodes to compose art (or even component-based code?) would be my guess. Though sure, for many scenarios/designs a node swap wouldn't be needed.