Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | lalel345 |
when I write this I am adding 10 new nodes instantiated to my scene, but they all appear in the same position. how I do to establish a certain separation between them?
onready var scene = preload("res://Sprite.tscn")
func _ready():
pass
func _physics_process(delta):
if Input.is_action_just_pressed("ui_accept"):
for i in 10:
var instance = scene.instance()
add_child(instance)
If you are talking about a 2D project and you just want to place them next to each other (instead of on top of each other), you could simply add this line below the add_child statement:
instance.position += Vector2(10,10) * i
Thomas Karcher | 2021-01-20 15:29