Sequence of buttons?

Get help using Construct 2

Post » Fri Mar 17, 2017 3:26 pm

Regards

I am new to construct 2 and in the forum.

When starting my project I realized that the occion to create sequence of buttons is not in sight would help me a lot if I could explain it in the simplest possible way.

To have an idea what I mean I want to press 2 a key my personage dodge or run and perform combos.

Thanks in advance. :D
B
6
S
1
Posts: 6
Reputation: 362

Post » Fri Mar 17, 2017 8:12 pm

add a KeyIsDown to the condition to OnKeyPressed

example add 2 conditions to your Event:

>> On Key 'N' is pressed
'Shift' is Down

This will only Trigger when the player hits N+Shift together
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Fri Mar 17, 2017 9:22 pm

jobel wrote:add a KeyIsDown to the condition to OnKeyPressed

example add 2 conditions to your Event:

>> On Key 'N' is pressed
'Shift' is Down

This will only Trigger when the player hits N+Shift together


You will also have to create the inverse condition
>> On key `Shift` is pressed
`N`is Down

Otherwise the order in which you press the keys would matter.
B
4
S
1
Posts: 5
Reputation: 310

Post » Fri Mar 17, 2017 9:41 pm

You use ON KEY DOWN to read a key.

You use ON KEY RELEASED to read when a key is up.

You need both in most games to change the sprite animations between idle and moving

Example:

On Left Arrow is Down: Simulate Player Moving Left, Set Animation to "RunLeft"
On Left Arrow Released: Set Animation to "Idle"

If you are using the platform behavior the arrow keys are already set to the basic movents but you will have to set the appropriate animation for each key.
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,830

Post » Fri Mar 17, 2017 9:46 pm

juanfrancoc wrote:
jobel wrote:add a KeyIsDown to the condition to OnKeyPressed

example add 2 conditions to your Event:

>> On Key 'N' is pressed
'Shift' is Down

This will only Trigger when the player hits N+Shift together


You will also have to create the inverse condition
>> On key `Shift` is pressed
`N`is Down

Otherwise the order in which you press the keys would matter.



Many thanks to both for your help but as it would be if I wanted my personage to walk and to press 2 veces D run
B
6
S
1
Posts: 6
Reputation: 362

Post » Fri Mar 17, 2017 11:03 pm

juanfrancoc wrote:
You will also have to create the inverse condition
>> On key `Shift` is pressed
`N`is Down

Otherwise the order in which you press the keys would matter.


it depends - if you want something only to happen when both are pressed, then yes, but in my case you need to add the modifier first. It's like when you type a capitol letter on a keyboard . You hit SHIFT first, then the letter. If you hit the letter first, the letter is lowercase, hitting the SHIFT after does nothing.
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Fri Mar 17, 2017 11:04 pm

Per3za wrote:if I wanted my personage to walk and to press 2 veces D run


what are the walk controls?

what is veces?
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Fri Mar 17, 2017 11:16 pm

jobel wrote:
Per3za wrote:if I wanted my personage to walk and to press 2 veces D run


what are the walk controls?

what is veces?


Sorry I meant that if I give it to walk again run.

So D walk - DD run
B
6
S
1
Posts: 6
Reputation: 362

Post » Fri Mar 17, 2017 11:48 pm

So D walk - DD run

That is impossible. Unless it keeps walking when D is PRESSED once. In that case you need another key to stop it. If that is what you want, then it is easy. A second PRESS will run. Release the key and it keeps running/walking. Until another keys is pressed, eventually a 3th D PRESS.

Why ?
Well, when you want it to walk when HOLDING D, it will immediately run because you are HOLDING D. And there is no way around that.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Mar 18, 2017 2:04 am

99Instances2Go wrote:So D walk - DD run

That is impossible. Unless it keeps walking when D is PRESSED once. In that case you need another key to stop it. If that is what you want, then it is easy. A second PRESS will run. Release the key and it keeps running/walking. Until another keys is pressed, eventually a 3th D PRESS.

Why ?
Well, when you want it to walk when HOLDING D, it will immediately run because you are HOLDING D. And there is no way around that.



Thanks for the help.
I will see how I can accomplish that.
B
6
S
1
Posts: 6
Reputation: 362

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests