Advertisement

Character Keys Control.. Confused..

Started by August 30, 2000 04:32 PM
0 comments, last by HellRiZZer 24 years, 3 months ago
OK, I got a character and I have 8 keys to control it, the NumPad. So, when I''m pressing the key 2, my flag, say KeyDown becomes true. But if I press simultaneously two keys like 2 and 1, then my flags for them becomes true and it calculates the direction to move to. So, I just asking what I have to do with it''s movements: to use like If DownKey=True and LeftKey=false and RightKEy=False and so on, for each press, or there is another way to do that? Like some of DINPUT operations? I didn''t get to DInput yet, but if it''s a way to solving my prob,I''ll go on it. Thanks!!
In DirectInput you can save the state of all the keys into a keys[] array which you can then access like: keys[DIK_UP] (for the up key). This is basically a system like what you have described.

Is your first question asking what to do if more than one key is down? You could set up some sort of order of importance for the keys and just check if the most important are down first in an if statment, then use ''if else'' for all the others. You could also set a flag like ''alreadyMoved'' to true when the character has moved.

- Daniel
VG Games
- DanielMy homepage

This topic is closed to new replies.

Advertisement