Godot Version
Im in the last version godot 4.7.2
Question
So im making a card game like hearthstone and im pretty new to doing code. im looking to make my cards attack, but for that i need them to check on what board they are and look at each placement (1 to 6) to attack a random enemy
here is how i organize everything :
And my card is going to be on board A or B, and then my code for now :
extends CharacterBody2D
@exportexport var stats: Res@onreadyurce
@onready var vie: Label = $VBoxCon@onreadyainer/degat
@onready var degats: Label = $VBoxContainer/vie
const BOARDS = preload(“uid://01j33dxd87fh”)
func _ready() → void:
if stats:
stats.out_of_health.connect(_on_out_of_health)
update_health_text()
update_damage_text()
func take_damage(amount: int) → void:
stats.health -= amount
func _on_out_of_health() → void:
print(“Character died!”)
func update_health_text():
vie.text = "Vie: " + str(stats.health)
func update_damage_text():
degats.text = "Degat: " + str(stats.attack)
func attaque():
pass # this is for my futur attack func
My recourses for the stats :
class_name stats_card
extends Resource
@e@exportport var max_health: int
@export var health: int
@export var attack: int
signal health_changed(new_health)
signal out_of_health
func take_damage(amount: int) → void:
health = max(0, health - amount)
health_changed.emit(health)
if health == 0:
out_of_health.emit()
I didn’t found anything about scaning or cheking if they are in a node and then attacking so im really lost to how i have to do my code
Thanks for the help in advence

