Keybindings?

Get help using Construct 2

Post » Thu May 28, 2015 4:35 am

Hey there! ;)
I am looking for a tutorial or a way to do keybindings. I searched for it, and couldn't find any post about this.
Keybindings like;
In game you go to options -> set a key for jump/attack and other buttons, save, and then be able to use those keys you set in options, in game.

Anyone? :)
Thanks in advance.
B
5
S
1
Posts: 37
Reputation: 451

Post » Thu May 28, 2015 12:34 pm

Image

I think this is pretty self-explanatory.
If you have trouble with it nonetheless, just holler at me :)
B
68
S
28
G
7
Posts: 85
Reputation: 7,496

Post » Fri May 29, 2015 6:44 am

EpicPixel wrote:Image

I think this is pretty self-explanatory.
If you have trouble with it nonetheless, just holler at me :)


Hey there! ^_^
Thanks for taking your time, but no i have absolutely no idea what you did there.
I want to be able to map keys for Jump/Attack/Dash and so on. Not last key pressed is it, etc.

Just a normal way where you go to options, and bind the keys you want to movement.
Save em and then use em ingame, like any options/keybind set on.. any game really.

Thanks for trying though, i just think you got me wrong ^_^
Thanks anyway!
B
5
S
1
Posts: 37
Reputation: 451

Post » Fri May 29, 2015 10:30 am

The group "for testing" is only for getting the keycodes, it doesnt bind keys to anything, it just sets the variable "keycodeCheck"

1. Press a button or key ingame to get the corresponding keycode of it. You can see the keycode when you watch the variable "keycodeCheck" in the Debugger.

2. Once you know the keycodes you can create variables for all your controls (Jump/Attack/Dash) and assign default values to them (the keycodes of the keys/buttons you got in step 1.) This will be the standard Keybindings the game starts with.

3a. (this is the easy way) All you have to do from here is building a menu where the player can either press a button/key to assign a key to an action (jump)
3b. or he can choose from a list of available buttons/keys.
In this case you would need a list of all keys/buttons and there corresponding keycode, maybe saved in an .xml file.

4a. when the player pressed the button/key you can get the keycode with the expression "Keyboard.LastKeyCode" for keyboard or "Gampad.LastButton(gamepadIndex)" for gamepad. Set the variable for the action (jump) to the keycode
4b. Like above but instead of pressing a button the player would choose a button/key from a list.

example jump button/key.
you want the standard jump key to be spacebar on keyboard and A on gamepad.
Use the "for testing" group stuff to get your corresponding keycodes. (spacebar= 32 A=0 ...i think :? )
create variable "keyJump" and set it to "32"
create variable "padJump" and set it to "0"
Give the player a way to choose the own button/key 4a or 4b
set the variable "keyJump" or "padJump" to the new value "n"

I hope it helps.
I would highly suggest to pick the "a" route, where the player has to push a key to assign it. It's mutch easyer to implement and more convenient for the player.
But maybe i still totally misunderstood what you want :shock: :lol: ...but maybe it helps someone else than :D
B
68
S
28
G
7
Posts: 85
Reputation: 7,496

Post » Fri May 29, 2015 9:39 pm

EpicPixel wrote:The group "for testing" is only for getting the keycodes, it doesnt bind keys to anything, it just sets the variable "keycodeCheck"

1. Press a button or key ingame to get the corresponding keycode of it. You can see the keycode when you watch the variable "keycodeCheck" in the Debugger.

2. Once you know the keycodes you can create variables for all your controls (Jump/Attack/Dash) and assign default values to them (the keycodes of the keys/buttons you got in step 1.) This will be the standard Keybindings the game starts with.

3a. (this is the easy way) All you have to do from here is building a menu where the player can either press a button/key to assign a key to an action (jump)
3b. or he can choose from a list of available buttons/keys.
In this case you would need a list of all keys/buttons and there corresponding keycode, maybe saved in an .xml file.

4a. when the player pressed the button/key you can get the keycode with the expression "Keyboard.LastKeyCode" for keyboard or "Gampad.LastButton(gamepadIndex)" for gamepad. Set the variable for the action (jump) to the keycode
4b. Like above but instead of pressing a button the player would choose a button/key from a list.

example jump button/key.
you want the standard jump key to be spacebar on keyboard and A on gamepad.
Use the "for testing" group stuff to get your corresponding keycodes. (spacebar= 32 A=0 ...i think :? )
create variable "keyJump" and set it to "32"
create variable "padJump" and set it to "0"
Give the player a way to choose the own button/key 4a or 4b
set the variable "keyJump" or "padJump" to the new value "n"

I hope it helps.
I would highly suggest to pick the "a" route, where the player has to push a key to assign it. It's mutch easyer to implement and more convenient for the player.
But maybe i still totally misunderstood what you want :shock: :lol: ...but maybe it helps someone else than :D


Hey.. No this doesnt really help, i still dont understand what you are trying to do/say. I know what you mean by the IDEA, but not just how to execute it. I just want a player to be able to go to options, and bind a key upon pressing on it. For example, press on ''Jump'' and then the player presses a KEY on keyboard or gamepad and done. Now jump = the key the pressed. I just dont know how to do that. Thanks for trying though, im gonna try to find someone to make a capx and pay them like 30$ or something.

Thanks for your time anyway.
B
5
S
1
Posts: 37
Reputation: 451

Post » Fri May 29, 2015 10:07 pm

Image
B
64
S
23
G
7
Posts: 1,482
Reputation: 10,825

Post » Fri May 29, 2015 11:33 pm

korbaach wrote:just a thought..

capx> http://s000.tinyupload.com/index.php?fi ... 6798188593


Yes! That is it!! Thanks aloooooot! So perfect :)))
Thank you very much for putting down your time to make this capx, really! ^_^
B
5
S
1
Posts: 37
Reputation: 451


Return to How do I....?

Who is online

Users browsing this forum: adamebastin, Google [Bot], plinkie, Yahoo [Bot] and 7 guests