How do I have two keys trigger the same event

Get help using Construct 2

Post » Mon Aug 24, 2015 1:36 am

For example, I have the 'p' key execute a dozen actions.

I'd like the 'start' button on the gamepad to execute those same actions.

Do I have to copy and paste all those actions into a separate event for that button?

That won't be ideal because then if I make changes to the actions, I'll have to make those changes in two places
B
6
S
1
Posts: 33
Reputation: 495

Post » Mon Aug 24, 2015 1:41 am

You'd place your events in a function, and then call the function from those two trigger events.
ImageImageImage
B
71
S
22
G
247
Posts: 3,756
Reputation: 137,558

Post » Mon Aug 24, 2015 2:05 am

Wow.. I assumed there weren't functions

Awesome
B
6
S
1
Posts: 33
Reputation: 495

Post » Sat Sep 12, 2015 8:17 pm

hi, can U post a sample please ?
B
37
S
16
G
2
Posts: 451
Reputation: 4,873

Post » Sun Sep 13, 2015 5:38 am

there is also the "or"

key "a" down
OR
button "start" down : do this (or call function)
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Sun Sep 13, 2015 8:57 am

why use functions ? when you have right click condition and select OR then add your secondary key... using functions will only confuse you ... and will make ur game performance very bad... is not the same as in native programming... it will take longer to find the functions which will end up in creating bugs and delays between Action calls ...
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005

Post » Sun Sep 13, 2015 10:50 am

I was not aware that functions cause any slowdown - surely it depends on the function and its use ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 6 guests