hi! I’m Octo and I’ve been working on this tiny RPG that’s still in an early stage. I recently started workin on the UI but well… i got some problems. So, I have this tree:
the idea is to have a TabConteiner where I have an inventory, and in it, i have a columm with the key items (item slot). And, because my game will feature point’n click elementes, I wanna be able to combine these items. So, in the item slot scene, there’s a child node called Outline, which is a poligon 2d with inverted on and clip children at clip only, and as child of this one i have a color rect with Yelow color. My idea is that when I press Combine the outline turns on, reavealing which slot i’m currently selecting, but when I click it, nothing happens, however, if I “hide” the UI and show it again it shows the outline, how do i fix this?
Also, here’s my code:
class_name Item_slot
extends Control
@export var id: int
@onready var outline = $Outline
var hovered: bool = false
@warning_ignore(“unused_parameter”)
func _process(delta):
hovered = Global.items_hovered[id]
if Global.items[id] != "none":
self.text = Global.items[id]
outline.visible = hovered
queue_redraw()
get_parent().get_parent().queue_sort()
Make sure you set Mouse > Filter - Ignore on every Control that is not supposed to interact with mouse, i found that most often ui “doesn’t work” if its blocked by something stealing mouse events
nope, that didn’t work. I’d send a video of the bug, but it seams new users can’t do this here. I posted this page’s link on the godot discord server, hopefully this will bring more people to help.
which is picking an array in the Global script to set all to false, and then it picks the given variable, which is the ID of the current item slot being “hoverd”, and sets it to true in correspondent data the array.
After this, the item slot code picks the value correspondent to it’s ID in the array. If that value is true, it shows the outline by turning on the visibility of it’s child, being this one a inverted poligon 2d with clip only and a yellow color rect as child.
If you need to see the full codes, i put them in this discord chat: Discord
my current next try, is to remake the scene while tring a new logic and maybe discover what’s wrong, but i’ll wait your answer.
so, i got a solution, instead of actually adding an outline to the text, i just changed the color of the text. here’s the result
(had to put in a link cuz the file was to big)
I know, i know, it isn’t exactly what i wanted, but i mean… if i went to what i really wanted, i’d make a whole persona-like ui, which would take years with my current skills. So i’m pretty satisfied.
Thanks to all the involved ones, your patience and help allowed this to work @mrcook and @codingus .