
Down Arrow Key:
- 144 or bge.events.DOWNARROWKEY
- 143 or bge.events.LEFTARROWKEY
- 145 or bge.events.RIGHTARROWKEY
- 146 or bge.events.UPARROWKEY

Sample Code
################ get the Key Code for the key triggering the keyboard sensor
# import bge module
import bge
# get the python controller
cont = bge.logic.getCurrentController()
# get the keyboard sensor
# My keyboard sensor is named Keyboard_1
sen = cont.sensors["Keyboard_1"]
# get the keycode of the key that triggers sensor
keyCode = sen.key
Sample Code
################ set the Key Code for the key triggering the keyboard sensor
# import bge module
import bge
# get the python controller
cont = bge.logic.getCurrentController()
# get the keyboard sensor
# My keyboard sensor is named Keyboard_1
sen = cont.sensors["Keyboard_1"]
# use the up arrow key to trigger the keyboard sensor
# Up Arrow key: 146 or bge.events.UPARROWKEY
sen.key = 146