![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | da_dev |
So, I have a KinematicBody2d of a soldier and when I press, let’s say, ui_select a new soldier is created. I wrote this script for the root node, but it doesn’t seem to work.
func _input(event):
if event.is_action_pressed("ui_select"):
var soldier = get_node("Soldier").duplicate()
soldier.position = Vector2(get_viewport().size.x/2, get_viewport().size.y/2)
What is the proper way of doing this?