GMS 2.3+ Changing a sprite in a sequence

I've been enjoying using sequences to make fluid animations.
I have a project where I've been using sequences to animate a character, and I'd like to give the player the ability to customize their look. Chaining their hair or maybe give them a new item in their hand.
Normally with a sprite I'd make the hair styles on different frames and change the image_index, or I'd choose what sprite_index to draw
But the documentation on how to edit a sequence has left me confused on how to reach into the nested list of do that.
photo_2020-10-10_13-40-27.jpg

Take this track panel for example.
How would I in game change the sprite sShoulders so I could replace it with a sprite with a necklace at a certain point in the game?
 

slippy

Member
I've been messing with sequences as well. Use an object with a placeholder sprite that you can use for your animations and then you can change the sprite of the object with code.

GML:
if(instance_exists(oShoulders)){
    oShoulders.sprite_index = sShoulders_Necklace;
}
 

jonjons

Member
Trying to get gamemaker to print out a struct always crashes the exe and any attempts I've made to access them have been unresponsive
printing a sequence, it doesnt seem a good idea, the sprites are in there somewere inside a seqtracktype_graphic

seq.png
 

Cpaz

Member
I've been messing with sequences as well. Use an object with a placeholder sprite that you can use for your animations and then you can change the sprite of the object with code.

GML:
if(instance_exists(oShoulders)){
    oShoulders.sprite_index = sShoulders_Necklace;
}
This seems to be the best approach IMO, to use an object and change sprites using events (or the lightning bolt labeled as "moments" in the IDE).
Keep in mind that events are basically globally scoped functions, so if the sprite you want to change too is different depending on what the player chooses, you could simply call out to another object to handle that.
 
Top