how do i press double A to double punch

Get help using Construct 2

Post » Sun Aug 12, 2012 9:11 pm

im going to make A for single punch and if player rapidly press A it will spawn special punch!
B
16
S
3
Posts: 17
Reputation: 1,005

Post » Sun Aug 12, 2012 10:03 pm

You could try making some sort of a counter which will count how many time specific button was pressed and then do something.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Sun Aug 12, 2012 11:16 pm

i don't found any solution on this.
can you elaborate ?
B
16
S
3
Posts: 17
Reputation: 1,005

Post » Mon Aug 13, 2012 12:19 am

Have a global variable for Timer and ButtonCount
Every Tick at dt to Timer. This will create a timer
Every time A is pressed, add 1 to ButtonCount.
If ButtonCount >= 5 and Timer <= 5 then
Spawn special attack

Of course the number 5 can be changed. With this example, A has to be hit 5 times before the timer reaches 5 seconds.

You will need to make the timer reset each time the button is pressed as well so you know if they hit A in the allotted time.   Play around with it. I'm sure you will get it :).
ArcadEd2012-08-13 00:20:35
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Mon Aug 13, 2012 2:27 am

You'll need 'Combo' Variable
Default is 0

Punch Event 1
-Check if Combo is '0'
-If yes, it should set combo as '1'
-Execute Punch
-Wait 1 Second
-Set combo back to '0'

Punch Event 2
-Check if combo is '1'
-If yes, it should set combo to '2'
-Execute Punch 2
-Wait 1 Second
-Set combo back to '0'

This already deals with cooldown of attack 1, and combo 2.

B
36
S
10
G
6
Posts: 948
Reputation: 11,101

Post » Mon Aug 13, 2012 2:10 pm

i need capx to see an example =(..
sorry am noob
B
16
S
3
Posts: 17
Reputation: 1,005

Post » Thu Aug 16, 2012 7:22 pm

hello ? someone ?
B
16
S
3
Posts: 17
Reputation: 1,005

Post » Thu Aug 16, 2012 10:30 pm

ok i tried arcadED i succeed, but what is DT ?
B
16
S
3
Posts: 17
Reputation: 1,005

Post » Thu Aug 16, 2012 11:23 pm

and how do i ..

for example one combo MANA used for 50 2nd combo 50
so the next combo the player can't perform the COMBO because of mana lacked.

how should i do that ?
and once again thx to arcadED
B
16
S
3
Posts: 17
Reputation: 1,005

Post » Thu Aug 16, 2012 11:23 pm

Delta Time, it's a feature inside the engine. Delta time means a space of time between 2 point in a time line.

You can reproduce your request following this procedure:

- Create a number variable inside your instance (instance is the sprite object) and call it as "combo";
|- On keyboard "A" is pressed (for example);
|- If "combo" = 0;
-- Play the animation "punching1"
-- Add 1 to "combo";
- On animation "punching1" is finished:
-- Set "combo" to 0;
|- If "combo" = 1;
|- On keyboard "A" is pressed;
-- Play the animation "punching2"
-- Add 1 to "combo";


You can loop it, make different animations for each stage of the combo, or just repeat the combo animations, this way:


|- If "combo" > 0;
|- On keyboard "A" is pressed;
#when you have one animation for each combo sequence;
-- Play the animation "punching" & player.variable.combo;
#when you have two animation at all;
-- Play the animation "punching" & random(1,2);
-- Add 1 to "combo";

Don't miss to reset the "combo" variable to 0 when the "A" is not pressed by 1 or 2 seconds.

That's it. ^^TELLES08082012-08-17 03:52:46
ImageImageImageImageImageImage
B
93
S
20
G
14
Posts: 1,218
Reputation: 19,500

Next

Return to How do I....?

Who is online

Users browsing this forum: Lof, Yahoo [Bot], YoHoho and 22 guests