Need some help with 2 animation looping on same key press

Get help using Construct 2

Post » Fri Jan 13, 2017 11:30 am

Message: allevlativ can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
i have 2 animation

attack1 and combo1

on A key press my player will play attack1 animation and if the key is press again with under 0.25sec my player will play combo1 animation.

The problem is on the 3rd key press and so on it keep play the combo1 animation until the key is release then it will stop, how do i make my player keep repeating the animation to attack1 animation back after the animation combo1 is done even if i spam the the key?

see my event sheet here https://www(dot)dropbox(dot)com/s/58yjzoz5e8864bs/Untitled.png?dl=0
B
7
S
1
Posts: 10
Reputation: 406

Post » Fri Jan 13, 2017 2:39 pm

Maybe you could try this ?
On animation combo1 finished >> play animation attack1
B
38
S
10
G
9
Posts: 212
Reputation: 6,995

Post » Fri Jan 13, 2017 2:50 pm

I wouldn't personally use a wait action at event 15. I learned the hard way that in this circumstance, a timer is generally superior.

Place a timer behavior on your player object.
replace the condition at event 15 by "Attack1count = 0" (instead of <= 1)
replace "add 1 to attackcount" by "set attackcount to 1"
replace the wait action by "start timer for 0.25 seconds"
delete subtract 1 from attackcount

add event :
Player object, On timer --> set Attack1Count to 0

event 17:
add condition : Keyboard > on A pressed
add action : set Attackcount to 2

Depending if you want to allow the player to spam attack1 after combo1, you may want to add "start timer for 0.25 seconds" (or a different value) at event 17, so that attack 1 couldn't be launched before 0.25 second.

I don't know if it's clear, I didn't tried it in the editor and I'm not 100% sure that I understand what you want to achieve, but hopefully it'll help. ;)
B
32
S
6
G
1
Posts: 352
Reputation: 2,812

Post » Fri Jan 13, 2017 2:51 pm

anty21ro wrote:Maybe you could try this ?
On animation combo1 finished >> play animation attack1


I'm afraid the attack1 animation will play even if the button A isn't pressed again.
B
32
S
6
G
1
Posts: 352
Reputation: 2,812

Post » Fri Jan 13, 2017 3:24 pm

Try something like this: ( Combo1 is a Global Variable)

System > every tick - System add to > add dt to Combo1

Now just add your events:

Keyboard > on A released set Combo1 to 0

System > compare Combo1 - equal or less than 0 - On A pressed Play Attack1 from beginning

System > compare Combo1 - greater than 0 - On A pressed Play Combo1 from beginning
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Fri Jan 13, 2017 5:07 pm

Already use the timer but it stop when attack1 animation is finish

and using the dt i just dont know where to start

ive read tons of combo forum and video tutorial nothing solve my problem but i think the timer method is how it works

its like when combo1 is finish and the key is not press under 0.25sec, player play idle animation, but if the key is press under 0.25sec after combo1 is finish, player play attack1 animation back and this process will repeat over and over again until i stop spamming.

this is the capx www(dot)dropbox(dot)com/s/qi51yuvcpg0rtgi/IworryabouttheWarrior.capx?dl=0
B
7
S
1
Posts: 10
Reputation: 406

Post » Fri Jan 13, 2017 5:42 pm

To use the dt, i showed you how to try, just copy what i wrote.

I have something a little like what you are trying to do. It may work. It may not. Won't know till you try.

If you need help with my example, @ me.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Fri Jan 13, 2017 7:52 pm

jeffige wrote:To use the dt, i showed you how to try, just copy what i wrote.

I have something a little like what you are trying to do. It may work. It may not. Won't know till you try.

If you need help with my example, @ me.



what you mean @ me ? cant you give me your example here? i cant pm you
B
7
S
1
Posts: 10
Reputation: 406

Post » Fri Jan 13, 2017 7:57 pm

@ + allevlativ = @allevlativ

And look at my previous post. Just add a global variable. Call it whatever you want.

Add the events and actions just like my post.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Sat Jan 14, 2017 5:23 pm

@jeffige done like what you post

now when i run the game my player not play idle animation, it stuck on combo1 animation and when i press the A key its only play the combo1 animation
B
7
S
1
Posts: 10
Reputation: 406

Next

Return to How do I....?

Who is online

Users browsing this forum: Blendi1223, gskunk, zenox98 and 57 guests