Godot Version
v4.2.1.stable.official [b09f793f5]
Question
Hey all,
I am trying my hand at (my very limited understanding of) composition.
I have a top-level scene, that, in which, I want to put different objects. Object such as a table, a closet, etc.
I’ve made an object scene, where I’ve tried to make it as generic as possible. The object scene consists of an Area2D with a Sprite2D child (the sprite is set on the top level), a CollisionPolygon2D (the shape is determined on the top level), and (less important) an instantiated child Dialogue scene.
It works fine, to a degree. I can add the different objects with the same object scene in the top-levl scene, with sprites and the collision shapes working. I can click the objects and the dialogue gets correctly shown (Each object will have a different dialogue).
However, I want to show a cursor hand when I am hovering each object, and in inverse, I want the normal mouse cursor to show when I exit.
So I’ve added the_on_mouse_entered
and _on_mouse_exited
signals to the Area2D script and to determine whether to show a cursor hand or a normal cursor, I have an if condition in my _process
method that checks a boolean set in those signals.
Weirdly enough, it works on my first instantiated object, but the second it does not work.
When I print the booleans, in the _process
method, it indicates that the hover boolean (determined by the on_mouse_* signals) is continuously switching between true and false when I am hovering, but remains a steady false when not hovering the object.
To me, it seems to indicate that the _on_mouse_exited is also triggered even though the mouse remains on the object, but I am not sure. I am fairly new to Godot.
I hope this makes sense, and thanks for taking the time.