GMS 2.3+ Sequences that partially loop themselves

Hi everybody!
I have a question: "is there a clean elegant way to make a sequence partially loop itself?"
What do I mean by that?!

Captura de ecrã 2020-09-11, às 19.37.22.png

Take the above image as an example. I have a timeline that will make a sprite move the Broadcast Message "loop" is where the loop should start. In other words this animation should go from Start to Finish then come back till Loop and then to Finish again (ping pong between Loop and Finish).This would be pretty amazing for some animations. I would like to know your ideas ;)
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Moderator
Can't you just set the sequence playhead direction to reverse on sequence end? Like you could add a broadcast message at the loop point and then at the end of the sequence, then in a controller, check them and reverse the head direction as required.


So, in the broadcast message event, you'd check for loop then check the head direction and if it's positive ignore it, if it's negative, make it positive. Then you'd also have a case that checks the end broadcast message that makes the head direction negative. That should loop the section.
 
That seems to be a good way of doing it! I also though of making a moment and call a functions at a given moment.. but my question then is: can we easily access the layer sequence itself from within those functions calls or message broadcast?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Moderator
Broadcast messages will have an "element_id" key in the DS map that you can use to access the sequence element that generated the event.
 
So for accessing that broadcast message I need a broadcast event so I need to have an instance controlling that (right?) I cant do it internally with just the sequence? I took a look at the sequence events and there is no Message Broadcast event (yet?)
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Moderator
Yup, you'll need a controller instance.

NOTE: There is nothing stopping you adding the controller instance into the sequence, or use an instance that is already in the sequence to control it. ;)
 
Top