0 votes

hello there i would like to add more than one node at the same time instead of going back to create one each time

asked Mar 25 in Engine by payload505 (32 points)
edited Mar 25 by payload505

Do you mean in the editor or using var new_node = Node.new() code repetitively?

in editor press ctrl + d to duplicate node

i don't want to duplicate i want to be able to add for example collision2D with sprite

yes you can add collision2d with sprite , just add sprite child of collision 2d

2 Answers

+1 vote

I think that you're asking how to do it from the editor.
You should usually add one node at time; however, I think that your problem is that you're creating many different "blocks" and you don't want to iterate the process each time. In that case you should create a single node with all its sub-nodes; when you're happy with it, create a scene from it. From now on you simply load the scene each time you want to add a whole "block" (either in the editor or from code).

answered Mar 25 by the.Alien (71 points)

helpful thanks

Iam actually a begginer iam not creating alot of things i just think it's annoying

0 votes

It's also possible to make a tool script to quickly create commonly used nodes for example, attach this script to the scene node and clicking the bools in the inspector will create the nodes.

extends Node

var mesh_instance : bool
var static_body : bool

func _process(delta):
    if mesh_instance:
        mesh_instance = false
        var new_mesh = MeshInstance.new()

    if static_body:
        static_body = false
        var new_body = StaticBody.new()
        var collider = CollisionShape.new()
answered Mar 25 by Magso (2,469 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.