How do I fight mechanics and animation ????

Get help using Construct 2

Post » Fri Sep 04, 2015 2:34 pm

hey there.. i need help in fight animation and mechanic.?
what i wanna do is that when i press key"L" then it should play "punch animation". but after animation is finished it should get back to its original animation which it was in before which was "idle"
also i need demo or template if possible..and one more problem i am facing is that when i continuesly press "L" it should start animation and as soon as i leave "L" it should change back to "idle" .. cant use Key down or release , please anyone? or if i get some fighting demo ..?
B
5
S
1
Posts: 49
Reputation: 455

Post » Fri Sep 04, 2015 3:02 pm

Create a variable for your sprite 'Is Pressed'

On key pressed 'L' > Set 'Is Pressed' to 1 > Set sprite animation 'punch animation'

On animation finished 'punch animation' > Set 'Is Pressed' to 0 > set sprite animation 'Idle'

Make sure your animation is set to not looped.

Hope it helps
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Fri Sep 04, 2015 4:54 pm

thanks man , it worked like a charm.
also i need one more favor.. how do i do so if i press "L" it plays punch animation, and if i press again it plays different punch animation, and if i press again then again different animation.. i mean to say if i press "L" it should play random selected animations..??? i am new to c2. and working on very complex game. like DMC .. thanks man.. need help :P
B
5
S
1
Posts: 49
Reputation: 455

Post » Fri Sep 04, 2015 5:59 pm

Give it a variable 'Punch' :)

When 'punch animation' is finished > add 1 to 'punch' variable
When 'punch animation2' is finished > add 1 to 'punch' variable
When 'punch animation3' is finished > add 1 to 'punch' variable


if 'punch' variable is 0 > Play 'punch animation 1'
if 'punch' variable is 1 > Play 'punch animation 2'
if 'punch' variable is 2 > Play 'punch animation 3'

if 'punch' variable is 3 > subtract 3 from 'punch' variable

PUNCH!
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Sun Sep 06, 2015 5:34 pm

hey thanks, but can you please do it by adding keyboard example too. and CApx file too thanks ... :)
B
5
S
1
Posts: 49
Reputation: 455


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 52 guests