I’m new to Godot and it’s functionalities, so I’m messing around finding out. The thing is, Some signals shennanigans are messing with my head. I’m trying to set a basic card hand visual, adding and removing cards with buttons. To remove, I need to hover the card, select it and click a button to remove it from hand. Now, the hover part is simply making me crazy, the signal emitted from_on_area_of_click_mouse_entered()
simply don’t seem to be working. I’ll paste specific parts of the code that should use it.
On Card
:
signal mouse_hovering(card: Node2D)
signal mouse_unhovering(card: Node2D)
func _on_area_of_click_mouse_entered():
print("mouse entered")
emit_signal("mouse_hovering", self)
func _on_area_of_click_mouse_exited():
emit_signal("mouse_unhovering", self)
On Hand
:
func add_card(card: Node2D):
hand.push_back(card)
add_child(card)
connect_card_signals(card)
func connect_card_signals(card):
card.connect("mouse_hovering", Callable(self, "_hover_card"))
if card.is_connected("mouse_hovering", _hover_card):
print("connected")
card.connect("mouse_unhovering", Callable(self, "_unhover_card"))
func _hover_card(card: Node2D):
print("hovering" )
func _unhover_card(card: Node2D):
print("unhovering")
What happens is, it prints “mouse entered” when the mouse is in collisionshape2d area, prints “connected” in connect card singnals but never prints “hovering”. for more context, the cards that are being hovered or not aren’t the same as Card.tscn, but they extend it, I don’t know if it would make it break or not. Thanks in advance!