Godot Version
Godot 4.7 linux
Question
I’m working on a very basic playing card game as my first project on Godot. Clicking on a card(or specifically the button attached to it) is meant to do an effect based off of the suite and rank, so I made a class named Card, and exported the rank, suite, sprite, and the button. Here is the code for the class
class_name Card
enum Suite {HEARTS, DIAMONDS, SPADES}
@export var suite := Suite.HEARTS
@export var rank := 2
@export var sprite_2d: Sprite2D
@export var button: Button
@onready var button_1: Button = $Button
func _on_button_pressed() -> void:
if suite == Suite.HEARTS:
##test
Global.debug_message = "Hearts " + str(rank)
elif suite == Suite.DIAMONDS:
##test
Global.debug_message = "Diamonds " + str(rank)
else:
##test
Global.debug_message = "Spades " + str(rank)```
The node that I used as the base class works as intended when changing its rank and suite, but trying to make a new node using that class, and copying the sprite and button nodes as-is, and assigning everything correctly, the new card doesn’t work. The button is clickable, but it doesn’t do the function
