combo

Get help using Construct 2

Post » Wed Sep 25, 2013 4:59 pm



I'm new to C2 programming. I have been spending hours on this. After I use the 3 hit combo, I can't use even the first attack of the combo again.

I tried implementing the post of Rory here
http://www.scirra.com/forum/how-do-i-press-double-a-to-double-punch_topic55443_post347045.html#347045

I don't know what conditions to implement the "wait 1 second" part, but earlier I tried this (instead of the place of "Set Combo to 0" in the screenshot

Condition:
system--> time >= 1 sec
Action:
Set Combo to 0

It doesn't work.

btw, "Combo" is an instance variable of Luffy.

Luffy is the name of the character.

My other problem is how to make the character stop moving even if I press the left or right arrows. The "Set Vector X to 0" there in the pic doesn't solve it.

B
16
S
7
Posts: 301
Reputation: 2,726

Post » Wed Sep 25, 2013 5:28 pm

If you want to prevent the player moving use the platform 'Set ignoring input' or 'Set Platform disabled' action.

If you can't do the first attack again that would suggest that Combo isn't being set back to 0. Which would suggest that the animation isn't finishing. Could there be another event that changes the animation before "Combo3" finishes?
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,630

Post » Wed Sep 25, 2013 5:34 pm

ok.

about the animation, no. No other event changes the animation. That's the first 3 attacks I have programmed to the char. I have only movement events aside from those combo attacks.
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Thu Sep 26, 2013 8:47 am

After tinkering with the combo, I made it to work.

I want to make a run (separate from Walk) by double tapping right or left arrow, I am applying the same logic from combo. But it doesn't work.



Any tips?
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Thu Sep 26, 2013 9:01 am

you have something weird going on with your "is mirrored". First you check if the sprite is mirrored or not, but then, in the key press condition, you also check if the sprite is mirrored a second time. While in the facing left case it does not really matter, in the facing right it does because you first check that the sprite is not mirrored, then you check if it is, so the second condition will never be true.

Then something is messed up with the left/right arrows too. In your "facing left group" you check if the right arrow is pressed. Should it be the left arrow?
then in the "facing right" group, you check if the left arrow is pressed, but if the right arrow is released. There is definitely a mistake here

finally, the actions in the facing left and right groups are exactly the same. So even if your logic was right, it would not work.
B
12
S
5
G
2
Posts: 132
Reputation: 2,627

Post » Thu Sep 26, 2013 9:08 am

Yeah, sorry for the mistakes regarding buttons and mirrored checking. I fixed them.



But the actions inside both left and right were really intended to be the same since I thought they should do the same thing (run). So what's the correct logic for this situation?
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Thu Sep 26, 2013 9:43 am

Indeed, you don't need to duplicate everything. Actually, the fact that the character is mirrored does not matter, you can remove it. You can make an OR event: drag and drop the left arrow pressed condition inside the right arrow pressed condition. That means you need to press both the left and right keys for the event to be true. Unless you right click on the condition block and select "make OR" and that means the event will be triggered if the right arrow or the left arrow is pressed. But the "is walk animation playing" is also in the OR block, you need to move it out.
Something like this
-Right arrow pressed
    OR
-Left arrow pressed
   -luffy is animation playing ---> put your actions here

same thing for the arrow release, you can combine both in one OR block

EDIT: MY bad, forget what I said, you need to know which direction the character is already walking because if you press the right key while you're walking left, it would start running instead of turning around. But still I'm sure it can be optimized. And if you can't get rid of duplicated actions in the end, you should look into the Function pluginOlivierC2013-09-26 09:47:20
B
12
S
5
G
2
Posts: 132
Reputation: 2,627

Post » Thu Sep 26, 2013 10:13 am

I think I understood/followed your instructions, but the Run doesn't work still.


sgn152013-09-26 17:49:02
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Thu Sep 26, 2013 5:49 pm

any help? the run still doesn't work
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Thu Sep 26, 2013 8:20 pm

when you press the Right Or Left arrow, you are not in the "Pressed" condition. You are in "Key down"
B
38
S
13
G
4
Posts: 152
Reputation: 5,142

Next

Return to How do I....?

Who is online

Users browsing this forum: Mayfly and 8 guests