[Help]Plataform games:attacking

Get help using Construct 2

Post » Fri Oct 28, 2011 9:01 pm

Hey guys,
can you help me out?I want my plataform's main character to attack when i press the button,but he just starts to attack and he doesn't finish the animation,how can i finish my attack animation without having to keep pressing the button?
EDIT:Oh yea...the attack has to be a meelee attack,like,slashing with a sword or punching,not like a gun.
Thanksfmaf2011-10-28 21:07:58
B
16
S
5
G
1
Posts: 43
Reputation: 1,787

Post » Fri Oct 28, 2011 9:08 pm

If the problem is what I think it is, you should use what they call a state machine. Have a private variable for that character called "State", and use it to control animations. Like this:

On button pressed
>> Set State to "attack"

On "attackAnimation" finished
>> Set State to "stand"

If State = "attack"
>> Set animation to "attackAnimation"

If State = "stand"
>> Set animation to "stand"

See what I mean? It's really handy for controlling things, especially when you have more and more animations to cycle through.
SullyTheStrange2011-10-28 21:08:49
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Fri Oct 28, 2011 9:59 pm

Hey,Thanks
that's really useful
B
16
S
5
G
1
Posts: 43
Reputation: 1,787


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests