Play different object animations simultaneosly

0 favourites
  • 6 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I have a character sprite with multiple animation sets. Particularly one for running and one for punching. So that it does not look like my character is sliding across the floor while punching, I created multiple sets of animations - one of the top and one of the bottom halves of the run and punch animations. Four sets total, not including the full versions of both.

    In effect, what I hope to do is, while my character is running (bottom half of the run set), somehow "pin" (perhaps using the Pin behavior, perhaps not) the top half of the punch set to the bottom run set. Thus, I'd create the illusion of one animation set - punching while running. While I could just copy-n-paste both halves into a single set, this would create the problem the legs looking like they were reset mid-stride.

    I have an invisible platform object that the animations are set to that actually does the movements - that's not an issue. Individually, the animations are set to this platform object's origin point.

    What I'm wanting to do is see if it's possible to have two different animation sets active on the same platform object, but assigned to different image points, and will not conflict with one another.

    In summary...what I'm looking for is:

    The character is running (one set), then the punch button is pressed.

    The bottom half of the run set starts playing while the top half of the punch set plays through its sequence until it finishes.

    Once the punch set is done, the full run set resumes as normal.

    BUT, is it even possible to play two sets of the same sprite object simultaneously? OR, do I need to create a separate copy of the same sprite with the appropriate animations to be played at key times?

    Does that make sense? THANK YOU FOR YOUR HELP! <img src="smileys/smiley42.gif" border="0" align="middle" />

  • Yeah you are going to have to separate the two halves into different sprites and pin them together, or simply make the top half always follow the bottom half

    eg: every tick set position "top half sprite" to "bottom half sprite.y -50"

  • Rhindon - (i think) you can just pick them based on their UID and then set their animations that way. it may be easier (less events possibly) to just clone your animation set and crop it so one is the torso up and the other is the legs.

    pseudo sample code:

    -> platform - is moving-

    • sprite pick by ID - [instance UID]

          > set animation "running"

    -> (new event) key is pressed "punchkey"

    • sprite pick by ID - [other instance UID]

         > set animation "punching"

    --

    -> platform is moving

          - key is pressed

              > legs sprite - set animation

              > torso sprite - set animation

    another option is making a "running punch" animation where the player does a little jump while punch (like how people lunge forward when they punch) so it looks like they're leaping forward and then you maybe don't need to animate the legs while running and punching

  • justifun & wretchedshark - Thank you both!

    Shark: Actually, I had considered that "flying punch" for another attack option, but, either way, it is definitely a solution.

    Justifun: I thought about that, too. But my concern is that the Set Animation To action will override any other animation the same sprite is currently playing, regardless where I have it pinned/attached. But that solution did come to mind. I think I'll have to create separate sprite as you suggested.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Rhindon - the easiest way to figure this kind of stuff out is to make a quick prototype to test only the function you want to add <img src="smileys/smiley1.gif" border="0" align="middle">

    animation and picking instances (r117)

  • wretchedshark - Hmm...that .capx might just be the ticket. Gotta find a way to work it in to what I have set up already.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)