I am using Gscript with Godot 4.2 & I am new to coding so I’ll try to be as specific as possible
func MatchLineBase_Value():
get_tree().get_nodes_in_group("Mannequin Clothes")
var current_line_frame = $Top_Base/Top_Line/Top_Line_Ani.get_sprite_frame()
if $Top_Base/Top_Base_Ani.play("TShirt_Base"):
match current_line_frame:
var current_base_frame:
$Top_Base/Top_Base_Ani.get_sprite_frame()
What I’m Making: I am trying to make a 2D tycoon game where you add designs to clothes and then sell them. Right now I am just working on a little animated sprite of a tshirt on top of a mannequin that will rest in the corner and will change size and colour depending on what you do to the shirt you’ll actually be editing. The Base Art and the Line Art are two separate sprites, as I eventually want to make it so the colour of the base to change without the colour of the line art changing.
How I’ve Set It Up: Right now, I just have a loose tshirt sprite with 6 different frames for 6 different sizes (3 for female, 3 for male). Each type of top will have it’s own animation with the size of the sprites always in the same order (large female will always be the first frame on all the animations). I did this so the size changes are as easy as changing a frame and the top-type changes are as easy as changing an animation on the same sprite.
[Tree](https://i.sstatic.net/65CirDUB.png)
[AnimationPlayer for base](https://i.sstatic.net/82SkVS0T.png)
[AnimationPlayer for line](https://i.sstatic.net/UDGfByUE.png)
My Current Problem: I can’t seem to sync up the frames for the line art with the frames for the base. I have the Mannequin Clothes scene instanced to a Sewing Room Scene (that features the mannequin the clothes will be on) and it always seems to struggle finding the animation player or it tells me that functions like get_frames or current_animation_process are invalid for animation player.
It seems like putting the nodes in a group and adding get_nodes_in_group has stopped the error saying that it could not find the $Top_Base in relation to the Sewing Room scene. However, now it’s saying “Invalid Call. Nonexistent Function “get_sprite_frame” in base: AnimationPlayer.” Why is that? I have also tried the same with current_animation_progress and get_frame and get the same error.
If the way I am going about this is all wrong and I need to start over, I am very open to that considering I’m not all that far into my game yet. I just started. Thanks to anyone willing to help!
StinkyGuyJeff is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.