Sophisticated animation sequence

Hi -- totally new user here (as in I just downloaded GS earlier today). Before I get too deep into this, I want to make sure the game behavior I want to do is even possible, which is completely animation sequence-based:

  1. User has two series of buttons to choose from, with one series controlling a group of animations, and the second series controlling sub-animations for each group. So there would be A, B, C buttons, and then 1, 2, 3 buttons -- except the numbers really mean A1, A2, A3 if you're in the A animation, and B1, B2, B3 if you're in the B animation, and so on.
  2. Tapping/clicking on the A button automatically starts the A1 animation, B automatically starts the B1 animation, and so on.
  3. HERE'S THE POTENTIALLY TRICKY PART: Once any animation is started, I want to be able to randomly pull from other animations I want ... basically like a variable array in JavaScript ... and then have those animations play continuously in a random sequence, looping indefinitely until the user taps/clicks on another button. So in A1 there may actually be A1i, A1ii, A1iii, etc., and I want to have A1 play any of those random three animations continuously and indefinitely.

I understand that looping will block any subsequent behaviors, but is there a way to make this sort of animation array randomization and indefinite looping possible?

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2016

    @jrlamar said:
    Hi -- totally new user here

    Welcome ! Good luck ! :smile:

    @jrlamar said:
    1. User has two series of buttons to choose from, with one series controlling a group of animations, and the second series controlling sub-animations for each group. So there would be A, B, C buttons, and then 1, 2, 3 buttons -- except the numbers really mean A1, A2, A3 if you're in the A animation, and B1, B2, B3 if you're in the B animation, and so on.

    Yes, that's very easy to set up in quite a few different ways depending on your particular needs.

    @jrlamar said:
    2. Tapping/clicking on the A button automatically starts the A1 animation, B automatically starts the B1 animation, and so on.

    Yep, easy to do . . .

    @jrlamar said:
    3. HERE'S THE POTENTIALLY TRICKY PART: Once any animation is started, I want to be able to randomly pull from other animations I want ... basically like a variable array in JavaScript ... and then have those animations play continuously in a random sequence, looping indefinitely until the user taps/clicks on another button. So in A1 there may actually be A1i, A1ii, A1iii, etc., and I want to have A1 play any of those random three animations continuously and indefinitely.

    No problem here too, I've done a bunch of things pretty much identical to this, branching animations, where animation sequence X is playing and some condition is met (a button is pressed for example) and sequence X switches to sub-sequence X - but on the corresponding frame . . . .

    . . . so for example sequence X is playing . . . X1 X2 X3 X4 X5 X6 . . . and then a condition is met and we switch to sub-sequence X . . sX7 sX8 sX9 sX10 sX11 . . etc

    All this stuff is fairly straightforward.

  • jrlamarjrlamar Member Posts: 2

    Socks: Beautiful! I appreciate the quick feedback!

    Yes, thanks for elegantly rewording what I was looking for: branching animations. So based on what you're saying about conditional switching, would it be possible to just "ping-pong" between two branching sets. By that, I mean if I press the X1 button and the default sequence is sX1 sX2 etc., when it gets to whatever the last sub-sequence is in that cycle, can I have it automatically and seamlessly switch to sX20 sX21 sX22 etc. And then when it gets to the end of that sub-sequence cycle, it goes back to the sX1 sX2 etc. sequence cycle? So then it's basically looping forever even though it's really just bouncing between branching animations?

    This would all need to happen in the same viewing space so it looks like one continuous animation.

    Also, I think I read the frame rate limit is 30 FPS with GS? Is that accurate? I was hoping to pull 60 FPS. By the way, these would be PNG files, which I assume is the preferred image format?

    Thanks again for your help and insight!

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2016

    @jrlamar said:
    Yes, thanks for elegantly rewording what I was looking for: branching animations. So based on what you're saying about conditional switching, would it be possible to just "ping-pong" between two branching sets. By that, I mean if I press the X1 button and the default sequence is sX1 sX2 etc., when it gets to whatever the last sub-sequence is in that cycle, can I have it automatically and seamlessly switch to sX20 sX21 sX22 etc.

    Yes, again that is pretty straightforward, you can detect the current frame that the actor is displaying by simply looking at the self.image attribute . . . . so if you have two image sequences, A and B, and the last image of sequence A is called "AAA084", you can have a rule that says 'when self.image is AAA084 . . . then move onto the next sequence'.

    @jrlamar said:
    And then when it gets to the end of that sub-sequence cycle, it goes back to the sX1 sX2 etc. sequence cycle? So then it's basically looping forever even though it's really just bouncing between branching animations? This would all need to happen in the same viewing space so it looks like one continuous animation.

    Yep, again, all pretty straightforward stuff.

    @jrlamar said:
    Also, I think I read the frame rate limit is 30 FPS with GS? Is that accurate? I was hoping to pull 60 FPS. By the way, these would be PNG files, which I assume is the preferred image format?

    The Animation behaviour and the Timer behaviour are both fine for everyday animation duties, but they top out at 30fps, I prefer to use either Constrain or Loop because they work at the code cycle speed, so can be used to play animation sequences at 60fps, there are various other ways to approach animation needs like Tables or custom timers and so on, it all depends on the specifics of your project.

    Yes _.png _files are the GameSalad preferred image format, although you can import various other formats which will be converted to .png on import.

  • blobblob Member, PRO Posts: 229

    @jrlamar said:
    Before I get too deep into this, I want to make sure the game behavior I want to do is even possible, which is completely animation sequence-based:

    Indeed before you get too deep, it would be safer to ask you what size you intend these animation PNGs to be?
    For ex: Even with constrain behaviour, fullscreen at 30 fps will not work. Unless you don't mind choppy out of sync animations and extended loading time.

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2016

    Here are some very quick examples (GS file attached).

    Play the project . . . you have 5 little 29-frame animations, going left to right we have:

    A ) Looped sequence @10fps

    B ) Looped sequence @60fps

    C ) 3 Looped sequences @60fps (running seq1, seq2, seq3)

    D ) 3 Random sequences @60fps (sequences in random order)

    E ) 3 Looped sequences @10fps (press actor to change sequence - I've got this one playing at a slow frame rate so you can see the image sequence branches when pressed, that is to say it jumps from one sequence to another while keeping the correct place in the sequence, so A1 A2 A3 A4 A5 A6 B7 B8 B9 B10 B11 (etc) . . . rather than A1 A2 A3 A4 A5 A6 B1 B2 B3 B4 B5 (etc).

    As you can see the code for all of these is trivial, just a behaviour or two.

Sign In or Register to comment.