Godot Version
4.3
Question
I recently added a position y offset so that when hovering the card and scaling it up, it now offsets its y position for better viewing.
This is working if you play it normally but when I accidentally hovered over new cards so fast, it began moving in y positions rapidly and not returning to their own positions.
Here is the hovering code part
func on_hovered_over_card(card):
if card.card_slot_card_is_in:
return
if !is_hovering_on_card:
is_hovering_on_card = true
highlight_card(card, true)
$"../CardDetailedViewArea".display_card_details(card)
func on_hovered_off_card(card):
if !card.destroyed:
#check if card is NOT in card slot AND NOT being dragged
if !card.card_slot_card_is_in && !card_being_dragged:
highlight_card(card, false)
var new_card_hovered = raycast_check_for_card()
if new_card_hovered:
highlight_card(new_card_hovered, true)
$"../CardDetailedViewArea".display_card_details(new_card_hovered)
else:
is_hovering_on_card = false
$"../CardDetailedViewArea".hide_card_details()
func highlight_card(card, is_hovered):
if is_hovered:
card.scale = Vector2(CARD_BIGGER_SCALE, CARD_BIGGER_SCALE)
card.z_index = 2
card.position.y -= 130
else:
card.scale = Vector2(CARD_DEFAULT_SCALE, CARD_DEFAULT_SCALE)
card.z_index = 1
card.position.y += 130