![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Michiel Papenhove |
See the code below. I am wondering why the mouse_enter signal doesn’t get triggered. Can anybody help me out?
extends Node2D
var startMenuItems = {
"item1": "new",
"item2": "load",
"item3": "options",
"item4": "exit"
}
func _create_menu_items():
var fnt = load("res://fonts/Magegamefont2_smaller.tres")
var y = 0
for item in startMenuItems:
var label = Label.new()
label.set("text", item)
label.set("rect_position", Vector2(0,y))
label.set("custom_fonts/font", fnt)
connect("mouse_enter", label, "_on_mouse_over")
label.set("mouse_filter", Control.MOUSE_FILTER_STOP)
self.add_child(label)
y += 30
func _on_mouse_over(event):
print("mouse over")
func _ready():
_create_menu_items()
pass