• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED Possible to "mirror" a Sequence?

Hey all,

I've been experimenting a bit with using Sequences as an alternative to stuff like importing from stuff like Spine or Spriter, I thought it'd be cool to be able to build that sort of thing right there in GMS. Obviously this has some limitations since there's no skeletal features (right?) but the thing I was really hoping to see is a mirror option or ability to "flip" the sequence, like using sprite_xscale to flip a sprite around..

crabby.gif
Walking to the right works, but to the left.. not so great. :)

I've been up and down in the manual and haven't seen this kind of function anywhere. Does it really not exist?

Thanks
 
Never mind, turns out it was a simple enough operation for even a guy like me to get into the struct and flip things around. There's probably more I could do here but this did what I wanted:

GML:
if (_facing == -1)
            {
            var seqStruct = layer_sequence_get_instance(sequence);
            var trackCount = array_length(seqStruct.activeTracks);

            for (var i = 0; i < trackCount; i++)
                {
                seqStruct.activeTracks[i].scalex *= -1;
                seqStruct.activeTracks[i].posx *= -1;
                seqStruct.activeTracks[i].rotation *= -1;
                }
            }
 
Top