![]() |
Key numbers?
Hey guys, jamerson here. I am making a movement system that will make the players movement faster then the default, and I need to know:
What are the key names for up,down,left, and right? I am going to do keydown but I can't seem to get it right. I would appreciate any help I can get. Thanks much, -Jameson61894 |
You should probably go for keydown(), the numbers to use with it are the same as the direction numbers of players/npcs (0-3).
|
Appreciate it bro.
|
You could use a loop like such:
PHP Code:
|
If I remember correctly, the onKeyPressed() keycodes are 37, 38, 39 and 40.
|
Quote:
Hmm? The code I posted works just fine. |
Quote:
|
Well if he's making a movement system he's going to want to check for the keys in a timeout anyway, or else you get weird holding behavior.
|
Ya, onKeypressed() functions off of the keyboard preferences on the OS, much like actual typing. So if you have onKeypressed(), and you hold down S, it will input S, then after a moment repeatedly call the function over and over, just like holding down S would do in a text editor. The speed of which it does this depends purely on how the persons keyboard is set-up, so it would not function the same for everyone -- not ideal for movement at all.
|
GraalControl.onKeyDown and GraalControl.onKeyUp should work well.
|
on another subject, isn't keydown vastly superior since it will work if players choose to remap their keys?
|
Quote:
|
Quote:
|
Keycode check if anyone needs :)
PHP Code:
|
Quote:
Also, it is awkward to have an event-based system when limited by polling for checking the input. keydown has its merits, but there are definitely cases where you would want to use onKeyPressed or GraalControl.onKeyDown. |
| All times are GMT +2. The time now is 06:51 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.