#Area2D not updating world position correctly when parent moves ?

3 messages · Page 1 of 1 (latest)

earnest shale
#

Up

tepid tide
#

Please show some code (no picture)

earnest shale
# tepid tide Please show some code (no picture)

From the card side :

  func _on_HitBox_mouse_entered():
    isMouseOverCard = true
    doSelect()
    pass

  func _on_HitBox_mouse_exited():
    isMouseOverCard = false
    unselect()
    pass 

  func unselect():
    yield(get_tree(), "idle_frame")
    if not Tooltip_shown and not isMouseOverCard:
        emit_signal("unselected",self)
isSelected = false

func doSelect():
    yield(get_tree(), "idle_frame")
    if (isMouseOverCard or Tooltip_shown):
        emit_signal("selected",self)

Then I have the "hand" that handle the selection of the card when get the signals (this is to prevent multiple card from being selected)

func selectCard(Card):
    var target_pos = curr_pos - Vector2(0,bottom_offset)
    Card.outline.material.set_shader_param("disabled",false)
    Card.background.material.set_shader_param("disabled",false)
    $CardTween.interpolate_property(Card,"scale",defaultScale, select_scale,0.025,Tween.TRANS_SINE,Tween.EASE_IN)
    $CardTween.interpolate_property(Card,"rotation",rotation, 0.0,0.025,Tween.TRANS_SINE,Tween.EASE_IN)
    $CardTween.interpolate_property(Card,"global_position",global_position, target_pos,0.125,Tween.TRANS_SINE,Tween.EASE_OUT)
    $CardTween.start()