#I'm trying to design an interactable GUI for my 2d game

2 messages · Page 1 of 1 (latest)

stray basalt
#

Hey,
As the titel suggests I'm trying to make an interactable GUI for my game. Its gonna be a sniper like game where you pick people off based on their behavior from a distance. However to make it more fun I want to add different types of ammo you need to use for different types of targets. What I would like is that you can hover with the mouse over the ammo you wanne use and then click to select it. I'm trying to use control notes like VBoxContainers, MarginContainer and (for the bullets) textureRects to make it look structures and pretty. However, whatever I try and wherever I search, I can't seem to be able detect if the mouse is hovering over the texture. Am I using the wrong nodes for what I want?

Any advice is welcome, thanks in advanved!

fresh pier
#

Control nodes have the "mouse_entered()" and "mouse_exited()" signals which essentially tells you when your mouse is hovering over the texture.

Fyi, there is also a node called "TextureButton" which might be what you want to use instead. Gives you some more options for when you hover the button by default (change the sprite while hovering, when clicked, etc). Since TextureButton is a control node, it will also have the mouse-signals either way. The button also has some default signals that make it easier to actually do something when you click it