help : Consecutive attacks and animation

Get help using Construct 2

Post » Sun Jan 19, 2014 3:12 am

Hi to all!

I just got stuck in landing some attacks for game character. i read some threads and tuts but i cant get it properly done.

Here is a sprite of Zero that im using as a sample for my prototype in experimenting about attacks and changing weapons.



1. What i want to do is land an attack if i press the button once and "attack 1" will play.
but for the next, I cant make the second and third attacks when I press the button twice or trice.

2. How do i make the end of the slash or attack will only the one who can trigger to hit the enemy. my problem here is that when im standing above on a hitable object or enemy and pressed the attack, it still get hit.

3. when i press the attack and the attack 1 plays, the animation is a little messy and not centered. how can i make it centered then?

hope you guys can help me, thanks :DManeM2014-01-19 18:55:04
B
11
S
3
Posts: 4
Reputation: 858

Post » Sun Jan 19, 2014 6:55 pm

anyone?

cant still do it right > <
B
11
S
3
Posts: 4
Reputation: 858

Post » Sun Jan 19, 2014 11:45 pm

You'll want to use a few variables for this. One that shows what your last attack was, and a couple to act as timers. When you press the button to attack, check the state of the attack variables and do the logic accordingly.

So if you press the button with all the variables at 0, it will do the first attack and increment the variable that tracks what your last attack was, then start running down a short timer variable. If they attack while the last attack variable is 1 and before the timer is up, play the second attack and reset the timer. Then do the same for the third. This will let you combo attacks together, while reverting you back to the first attack if you don't attack for too long.

It can be a bit complicated, so if you aren't used to using variables you may want to read up on them a bit, and try to keep it simple at first. Maybe start by just implementing a single variable that increases by one with each attack, and plays a different attack animation based on its state.

For making only a certain part of the attack hit the enemy, you'll want to spawn a separate "hitbox" object, an invisible rectangle that overlaps with the sword but not with the rest of the enemy. Give the hitbox a lifespan variable so it doesn't stay around after the animation, or just remove it when the animation ends. You can even change the size and positioning of the hitbox to match the sword in different animation frames, though that gets more complicated.

If your animations aren't centered well, you want to change the hotspot, which is in the animation editor. It decides what point the animation is "centered" around, so you'll generally want it to be in a consistent place on the character.
B
7
S
1
Posts: 45
Reputation: 1,315


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 12 guests