-
Notifications
You must be signed in to change notification settings - Fork 0
INPUTS
Lili edited this page Jul 5, 2026
·
4 revisions
- Boolean
GetKey(int _id): returns true if given key's id is active (if the key is pressed), else returns false _id can be any integer, but there is some human-readable constants here just for you :-
KEY_RET= 8; -
KEY_TAB= 9; -
KEY_ENTER= 13; -
KEY_MAJ= 16; -
KEY_CTRL= 17; -
KEY_LEFT_VER_MAJ= 20; -
KEY_ESCAPE= 27; -
KEY_LEFT= 37; -
KEY_UP= 38; -
KEY_RIGHT= 39; -
KEY_DOWN= 40; -
KEY_0= 48; -
KEY_1= 49; -
KEY_2= 50; -
KEY_3= 51; -
KEY_4= 52; -
KEY_5= 53; -
KEY_6= 54; -
KEY_7= 55; -
KEY_8= 56; -
KEY_9= 57; -
KEY_A= 65; -
KEY_B= 66; -
KEY_C= 67; -
KEY_D= 68; -
KEY_E= 69; -
KEY_F= 70; -
KEY_G= 71; -
KEY_H= 72; -
KEY_I= 73; -
KEY_J= 74; -
KEY_K= 75; -
KEY_L= 76; -
KEY_M= 77; -
KEY_N= 78; -
KEY_O= 79; -
KEY_P= 80; -
KEY_Q= 81; -
KEY_R= 82; -
KEY_S= 83; -
KEY_T= 84; -
KEY_U= 85; -
KEY_V= 86; -
KEY_W= 87; -
KEY_X= 88; -
KEY_Y= 89; -
KEY_Z= 90;
-
Example of use :
class Move extends Behavior {
constructor(_transform) {
super(_transform);
// init-called data here...
this.speed = 10.0;
}
Update() {
// this instance is called once per frame...
if (GetKey(KEY_UP) == true) {
this.transform.y += this.speed * deltaTime;
}
if (GetKey(KEY_DOWN) == true) {
this.transform.y -= this.speed * deltaTime;
}
if (GetKey(KEY_RIGHT) == true) {
this.transform.x += this.speed * deltaTime;
}
if (GetKey(KEY_LEFT) == true) {
this.transform.x -= this.speed * deltaTime;
}
}
}