Godot Version
v4.4.1
Question
I’m trying to use a “check” and “apply” function in a card game script that changes based on which card is played. I have resources for each card that include things like name, description, sprite etc as well as a script reference. The script has the “check” and “apply” functions.
Essentially, I want to dynamically execute these functions based on which card is being played. I’m running into an issue where the version on my computer works, but my iOS build fails to call the function (stating it doesn’t exist). I believe this is because the version on my computer is pre-complied? Either way I think I am doing something incorrectly.
card resource script:
extends Node
static func check(board: Board) -> bool:
var normalized_array = board.get_normalized_ducks()
if normalized_array.size() != 1:
board.error.emit("Exactly 1 Duck must be selected")
return false
elif normalized_array[0] is not int:
board.error.emit("No Duck selected")
return true
#return normalized_array.size() == 1 and normalized_array[0] is int
static func apply(board: Board) -> void:
board.abduckt()
And I’m calling those functions here:
if card_to_play is ActionCard:
if board.get_selected_duck_array() != []:
var script = card_to_play.card_data.script_ref
if script.check(board):
script.apply(board)
action_card_manager.remove_card(card_being_dragged)
board.convert_to_colors()
else:
board.deselect()
I’m probably not approaching resources correctly here maybe?
Thanks for any help!
