Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | mymokol |
There is a KinematicBody2D in my scene that is supposed to trigger a function whenever the mouse enters it. It does have a CollisionObject2D as a child and everything. Here’s the simplified code (throwing away anything that isn’t related):
export var id = ""
signal grabbed
var mouse_over = false
var moving = false
func _ready():
$RichTextLabel.mouse_filter = RichTextLabel.MOUSE_FILTER_IGNORE
connect("mouse_entered", self, "_on_mouse_entered")
connect("mouse_exited", self, "_on_mouse_exited")
connect("grabbed", get_parent(), "child_grabbed")
func _input(event):
if Input.is_action_just_pressed("mouse_left") and mouse_over:
emit_signal("grabbed", self)
print("signal emitted")
func _on_mouse_entered():
mouse_over = true
print("mouse entered")
func _on_mouse_exited():
mouse_over = false
The outcome is that “mouse entered” doesn’t get printed.
I probably did something stupid, but what?