Implement basic CardContainer

This commit is contained in:
2022-07-29 20:49:32 +01:00
parent 349a1bf0d3
commit 40ccd28fb9
2 changed files with 28 additions and 98 deletions

View File

@ -11,10 +11,20 @@ var map_position : Vector2 = Vector2.ZERO
onready var target_position : Vector2 = position
var moving : bool = false
var cards = [] setget ,get_cards
func get_cards():
for child in get_children():
if "Card" in child.name:
cards.append(child)
return cards
func level_change(new_level):
# when leveing up restore health
health = base_max_health * pow(level, 1.5)
level = new_level
func _physics_process(delta):
@ -27,11 +37,13 @@ func _physics_process(delta):
#TODO: Replace with tween magic
position += (target_position - position)/2.5
func take_damage(damage):
health -= damage
if health <= 0:
die()
func die():
#Animation here
queue_free()