Godot Game Engine Tutorial: Duplicating Assets (nodes/scenes)
Hello and good day,
In my last tutorial, we've talked about Instancing, the term called when combining 2 or more assets just like the gif below where the ball asset was combined to the container asset (field).
You can check the whole tutorial in this link for review : https://utopian.io/utopian-io/@rye05/godot-game-engine-tutorial-instancing
In today's tutorial, our topic would be how to duplicate certain assets (nodes/scenes) in the Godot editor.
Let's start
- Launch Godot
- If you've followed my previous tutorial, you should have a sample project here that says Scene Instancing Demo. Double click to open it.
You can also go to this link to download the sample project named instancing.zip, just scroll down a bit and you'll find it.
http://docs.godotengine.org/en/stable/learning/step_by_step/instancing.html
- At least the editor should look like this. You can see the ball and container assets combined and on the lower left side are the assets you got.
Duplicating
The duplication method simply means creating an extra object that is the same as the original one. It can be an extra one or more.
There are 2 types of duplication:
- Parent and Parent
- Parent and Child
Their differences are simple, parent and parent duplication are assets that can move on their own while child assets can also move on its own, if their parent asset move, they will also move.
Let me show parent and parent assets duplication first
- To duplicate an asset, simply press control D after clicking the ball, notice on the right side that there are now 2 ball assets.
- Now let me show you what happens when I move the 2 ball assets, notice that they are moving independently. It's because they are both parent assets.
- Let's go ahead and duplicate a child asset. Delete one of the parent asset by going to the scene tab (right side) and right click on the asset and hit on delete.
- To create a child asset, hit right click on the ball asset and choose Instance Child Scene
- A new window will pop up where you can see a list of assets (scenes/nodes) to become a child, in this case we will choose the ball.scn, double click on it or hit open.
- It might seem similar to the parent to parent but take a note on the Scene tab on the right hand side, the child ball asset is somewhat linked to the parent ball asset.
- In the GIF shown below, you will see the difference between a parent and a child asset. If I move the child asset, the parent stays in its place but if I move the parent, the child follows the parent.
You can duplicate as much as you want. Note that if you duplicate a parent with a child asset, you duplicate them both but if you duplicate only the child asset, the parent asset will not be duplicated.
- Duplicating a parent asset with a child asset
- Duplicating only the child asset. If you move the parent asset, both child assets will move too.
- And here's what happens when you play the scenes. All assets including the duplicated ones will now be included in the Instancing.
That's the wrap for my post.
Thank you for reading.
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Thank you very much
Hey @rye05 I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
As a follower of @followforupvotes this post has been randomly selected and upvoted! Enjoy your upvote and have a great day!