Godot Game Engine Tutorial: Duplicating Assets (nodes/scenes)

in #utopian-io8 years ago (edited)

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).

U5dsSte21xBwpT6PiaTARsBnJzPiTY5.gif

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

U5dtj1f9j4H5cJdaLYBDZqFftsX6jrW_1680x8400.png

  • 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

U5dtj1f9j4H5cJdaLYBDZqFftsX6jrW_1680x8400.png

  • 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.

U5dtj1f9j4H5cJdaLYBDZqFftsX6jrW_1680x8400.png


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.

U5dtj1f9j4H5cJdaLYBDZqFftsX6jrW_1680x8400.png

  • 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.

1.gif

  • 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.

ScreenClip.png

  • To create a child asset, hit right click on the ball asset and choose Instance Child Scene

ScreenClip.png

  • 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.

ScreenClip.png

  • 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.

ScreenClip.png

  • 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.

1.gif

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

ScreenClip.png

  • Duplicating only the child asset. If you move the parent asset, both child assets will move too.

ScreenClip.png

  • And here's what happens when you play the scenes. All assets including the duplicated ones will now be included in the Instancing.

1.gif


That's the wrap for my post.

Thank you for reading.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

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

  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

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!

Coin Marketplace

STEEM 0.13
TRX 0.34
JST 0.034
BTC 115329.73
ETH 4470.08
SBD 0.86