Skip to content

Simplifying card reparenting #31

Description

@guladam

Reparenting CardUIs could be a lot simplified according to @Xiler6969's
YouTube comment.

That implementation for returning card to their original location in the hand has a bug and does not work.

Here is what i came up with that is much simpler and works for all edge cases:

func _on_card_ui_reparent_requested(child: CardUI) -> void:
	child.reparent(self)
	move_child.call_deferred(child, child.last_index)

func _on_card_played(_card: Card) -> void:
	for i in get_child_count():
		get_child(i).last_index = i

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions