Keyboard Code in Construct 2


Attached Files

The following files have been attached to this tutorial:



5,576 visits, 7,560 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Just before Christmas my teacher friend asked if I could create small application so, that he can find the right keyboard keycode to implement in his game for school project. I have passed the application keyboard keycode to him. Since then I thought why not pass this on for construct 2 user as well. It’s not that hard for Construct 2 user to find their keycode.

Simple let’s start

1. Create new project

2. Set windows size 640 x 480

3. Ste layout size to 640 x 480

4. Set background color as you like

5. Create TEXT title Key Code

6. Create 4 more TEXT and name it as below

7. Create 4 sprite 64 x 64 in any color and name it as below









Add four (4) GLOBAL Variables and name it

Key_1 = 0

Key_2 = 0

Key_3 = 0

Key_4 = 0

To find keyboard character code just press any key on keyboard once. Once you release the key click on 1st colour box to find out key code. Write down key code on paper. Now press 2nd key, as above 2nd colour box do same for 3 and 4. Once you have all the code for mapping key on keyboard use this code to map keyboard.

One thing to remember is you can find out all the 255 character code just by using this code project.

Your screen looks like below:

Let’s add code. Many would say I could have used loop to find code for each key or use keyboard on screen to show you keycode. Well I could but this is very simple method which everyone can understand and learn from it.

Add this code below:

Thank you and if you like it please leave comments, I am not not asking much God bless


  • Order by
Want to leave a comment? Login or Register an account!