Godot Version
Godot 4 3 Stable
Question
My goal was to have it so, depending on the level, the “magic arrow” would have different sprites.
This is because I wanted to associate the arrow’s sprites with the player character (Who I plan to give actual sprites later on).
The idea being that the game has 2 player characters (Same code, different sprites) and the magic arrows also have different colors, based on the respective characters.
But for some reason, the sprites that show up are the ones as selected in the editor and not the ones related to the export var code.
So I can’t give the arrow specific sprite resources depending on the level.
These are the lines of code I assume are relevant:
@onready var sprite = $AnimatedSprite2D
Which allows the node to be referenced in code.
@export var arrowskin = “res://assets/sprites/play actor/leonarrow.tres”
Which creates a variable for the sprites’ resource.
func ready():
sprite.frames = load(arrowskin)
Which should allow the AnimatedSprite2D loading the respective resource being reference in the editor, depending on the level.
The code I used is because I believed it might be similar to how I did it in my previous game, which was on Godot 3.5.1.
But anyway, here’s the project: GitHub - EyeBallTank/Hirdrih-Technologic: A game about the world of Hirdrih
And the relevant scenes are:
Regardless, any help is appreciated.