Hovering over a Node effect

Hey,
I had a question about nodes. I wanted to add some more feel to one of my games, and I thought that a good way to do that was make it so that when the mouse hovers over one of the buttons, the button dims, or in other words, slightly changes colors.
How might I go about doing that?
Thanks so much for your time again!

1 Like

Use gui.pick_node() every time you get a callback to on_input() with mouse movement. Track what node that the mouse/finger is currently hovering and when you detect a transition from ā€œno nodeā€ to ā€œsome nodeā€ you apply the effect and then reverse it when going from ā€œsome nodeā€ to ā€œno nodeā€.

@Vgreen, here’s an example which should put you in the right direction :slight_smile:

1 Like

@Axel and @samuel.nystedt: Is it possible to see the actual page title here instead of the ā€œFree 2D game engineā€ ? (E.g. ā€œDefold-examples: Pointer overā€

1 Like

Yeah, definitely. The Onebox, as Discourse calls the preview box, fetches the title property, so it would be a matter of setting this on all learn pages (and more, perhaps) to ā€œDefold examples – Pointer overā€ and such. I’ll add it to the backlog.

2 Likes

Thank you all very much for your time again! I will take a look at the manual, I’m sure that it will come in handy!
Thanks all again!

2 Likes

Ok, so I was able to use the code from that manual to make a hovering mouse effect. The next question I have is how to ac tally tint the node… not quite sure how to do that.
Any insight?
Thanks again!

Just use gui.set_color(node, color).

2 Likes

Oh duh, thank you very much!
haha