![]() ![]() Note, that the 'A' is a capital 'A', and that when using ord() the keyboard key to check must always be written in quotes and as a capital. ![]() So, the above will check the 'A' key and if it's being pressed then it'll set the horizontal speed of the object to -5. The following is a small example of how to use ord(): ![]() But, as it's a bit difficult to remember so many numbers and the relationship that they have with your keyboard, GameMaker: Studio has a series of constants for the most used keyboard special keys and a special function ord() to return the number from ordinary typed characters (either letters or numbers). Now, each key is normally defined by a number, called the ascii code, and you can directly input this number into these functions and they will work fine. You may find some of the in-built variables and constants aren't valid on other platforms and many of the functions won't work on mobiles. ![]() NOTE: These functions are designed for Windows/Mac/Ubuntu desktop platforms only. There are also some that store all the keypresses as a string or that can tell you what the last key pressed was, as well as others that allow you to clear the keyboard state completely. When dealing with the keyboard in GameMaker: Studio you have a variety of functions that can be used to recognise different keyboard states like pressed or released. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |