Godot Version
4.3
Question
Context:
im developing a card game where each creature has different stats and behaviours
Setup:
I have a generic card scene with all the stuff a card has by default: basic stats and sprite, as well as an animation player and other minor stuff. Attatched to the generic card’s root node is a script that loads in a resource. The resource houses each creature’s sprites, basic stats and script with the creature’s behavior. The behavior scripts of creatures are all extensions of a generic creature behavior script (Critter_base.gd). This script houses (at the moment) two functions: doAtk() and takeDamage().
And they both individually work.
The logic for doAtk() is just having a node (opp) as a parameter and moving the_node towards opp’s position and then back.
The logic for takeDamage() is just changing the text of a label to the damage taken and play an animation.
I tried having two cards at one singular scene to test making one card attack another: it didn’t work, even though i just called both functions.
(atacante and vitima are each just an instance of the card scene, both with the same resource attatched)
When i called to attack using the Atk function, not only did atacante do nothing, vitima did both of the things (doAtk and takeDamage). When asking in the godot server what was happening, i was told it had something to do with the resource.
I have no idea on what to do or how to solve this.
Can anyone help?