Hack'n Slash combat

Get help using Construct 2

Post » Fri Jul 25, 2014 12:19 pm

So as you can see from the title I want to know how to make a bit more complex combat than what I have currently in my game.
Basically I want something like this.
When I press the attack button I want my guy to swing a sword (attack animation 1) and move slightly forward. And if I press again I want him so swing sword in a different direction(attack animation 2) and move forward again , and when i press it third time he swings it in some other direction (attack animation 3), and moves forward.

It doesn't seem complicated to me but I just cant pull it off. I am still a learner so any help would be much appreciated.
Thanks in advance.
B
7
S
2
Posts: 102
Reputation: 975

Post » Fri Jul 25, 2014 12:55 pm

Create a variable (Attack) set to 0.

On (attack button) Pressed: Add 1 to Attack
subevent Attack = 1: Play attackanim1, move player forward (however you want to do this - Custom Movement or something should work)
subevent Attack = 2: Play attackanim2, move player forward
subevent Attack = 3: Play attackanim3, move player forward

You'll want some way to reset attack to zero - either whenever an attack animation finishes or after a specified time, depends how you want to do it.

I think that should work, you may have to play around a bit to get the results you want! If you want to post a capx I'll have a look. :)
B
15
S
4
G
1
Posts: 286
Reputation: 1,988

Post » Tue Jul 29, 2014 6:03 am

Cool solution, thanks
B
12
S
1
Posts: 6
Reputation: 583

Post » Sat Feb 28, 2015 5:28 am

Been looking for this answer all day. Much appreciated.
B
4
Posts: 2
Reputation: 204

Post » Sat Feb 28, 2015 11:36 am

It would seem that often the simplest solutions are out there begging to be found when you don't look hard enough.
B
8
S
2
Posts: 134
Reputation: 1,001

Post » Sat Feb 28, 2015 1:18 pm

@lolpaca That's the easiest solution for sure. In my beat em up game I wanted to make that you could punch slightly before the animation was finished so it would look smoother. I made a variable "AttackBusy" that was changed to 1 when you attacked and back to 0 on the final frames of the attack animation. You could only press the attack button or move when AttackBusy was 0. Basically this let the character attack with his weapon again without first putting it back in its seath or going into standing pose.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474


Return to How do I....?

Who is online

Users browsing this forum: 25games, jatin1726, kiki4construct, Username05 and 32 guests