Play different object animations simultaneosly

Get help using Construct 2

Post » Tue Feb 05, 2013 7:53 pm

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!
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
113
S
20
G
8
Posts: 741
Reputation: 13,661

Post » Tue Feb 05, 2013 8:05 pm

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"
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Tue Feb 05, 2013 8:09 pm

@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
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Tue Feb 05, 2013 9:51 pm

@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.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
113
S
20
G
8
Posts: 741
Reputation: 13,661

Post » Tue Feb 05, 2013 10:06 pm

@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

animation and picking instances (r117)
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Thu Feb 07, 2013 6:04 am

@wretchedshark - Hmm...that .capx might just be the ticket. Gotta find a way to work it in to what I have set up already.
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
113
S
20
G
8
Posts: 741
Reputation: 13,661


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests