#UI/Control help
10 messages · Page 1 of 1 (latest)
It's not entirely clear what exact functionality you're having trouble implementing
Removing it from the container? Adding it to the slot?
Because the ability slots are within a vbox container, i cannot seem to drag them outside of the container to slot into the highlighted tile which is below it and outside of the vbox.
Which is understandable, but i'm not sure which direction i should proceed, UI isn't my strong suit
Could you share some relevant code?
here's the main code for dragging and dropping for the draggable node:
if draggable:
if Input.is_action_just_pressed("select_input"):
initial_position = global_position # change to reference for return
offset = get_global_mouse_position() - global_position
GameManager.is_dragging = true
if Input.is_action_pressed("select_input"):
global_position = get_global_mouse_position() - offset
elif Input.is_action_just_released("select_input"):
GameManager.is_dragging = false
var tween = get_tree().create_tween() # necessary?
if is_inside_droppable:
tween.tween_property(self, "global_position", body_ref.global_position, 0.2).set_ease(Tween.EASE_OUT)
else:
tween.tween_property(self, "global_position", initial_position, 0.2).set_ease(Tween.EASE_OUT)```
Works fine in other scenes, I'm just not sure how to make it work with this scene since the setup of controls is peculiar
I was going to make it so that the parent of the draggable node is set to some other node, then on drop it would either take the body it's dropped in, or return to its origin, but it was very unsafe to do with a high potential for missing addresses which would throw errors
Honestly i'm probably just going to use each slot to populate an information menu and allow assignment from there. Alternative solutions or advice on the scene tree appreciated :)