[Solved]How do I let user choose their own keys?

Get help using Construct 2

Post » Fri Apr 11, 2014 6:32 pm

Hellow~
I'm wondering how we can let user custom their keys. Somewhere i read about using arrays, but i don't know how to start that thing. :1
I would like to have this implemented, a desktop game, that don't let you set your own keys its pretty akward :/

I was looking through forum pages, but i didn't see any topic related, but if it already exist, please pardon me.
It would be nice, if you could redirect me there. (:

Well.. that's it, have a nice day guys. :D
PD. Sorry for any grammar issues.
Last edited by Frame Matt on Mon Apr 14, 2014 3:41 am, edited 1 time in total.
B
9
S
1
Posts: 20
Reputation: 709

Post » Fri Apr 11, 2014 6:59 pm

you dont actually need an array object. U can do, would be better but u may not.
if your game has 7 keys forexample u can make this with 7 global variables too.

You will going to have preset of keycodes on this global variables already. Then you will going to use "keyboard" objects "on any key pressed" event. add 7 sub "if" events to that event by using "Compare two values" event. On each, u will going to compare one of your global variable with "Keyboard.LastKeyCode". if equal, then u will going to do actions for that key.

However this will going to be a long term control method if your game has like 30 keys. I suggest you to make your players to be able to choose "premade" key combinations. like using "awsd" instead of arrow keys ect. in such stuations.
Truth shall be your freedom...
B
14
S
2
G
1
Posts: 45
Reputation: 930

Post » Sat Apr 12, 2014 11:07 pm

Oh, i see.
So, if the player choose... let's say A, for 'Prev Weapon', the global variable for 'Prev Weapon' should be already with one keycode on it, if it was A... it should keep working the way it was with the A. But if the user choose something like S... with the "Keyboard.LastKeyCode" it should change the A, for the S... making things happen with it. (?) or isn't? :D?

Well, thanks you @Aleq , i feel like i can start messing around on Construct now. I think it would be better to discuss this with some capx, so i'll get to it.
Please, have a nice day (:

PD. Sorry for any grammar issues.
B
9
S
1
Posts: 20
Reputation: 709

Post » Mon Apr 14, 2014 3:39 am

@Aleq , check this :D
dropbox.com/s/xhx98n8k9shsy8z/customKeyboard_test.capx

Thank you so much!
I make it work, the way you said it!

But i found out that the "StringFromKeyCode" doesn't make all the string forms of the keycodes. I guess the best bet will be to make and array with the missing keys, put their names and call 'em from the array, isn't ?

Anyways. Thanks you again! :D
PD: Sorry for any grammar issues
B
9
S
1
Posts: 20
Reputation: 709

Post » Wed Apr 16, 2014 8:15 am

im glad to help
Truth shall be your freedom...
B
14
S
2
G
1
Posts: 45
Reputation: 930


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 48 guests