[HELP] What am i doing wrong (GetPlayerKeys)
#7

Quote:
Originally Posted by stepmex
All is considered
Not really because you're assuming the KEY_SPRINT was pressed before KEY_JUMP, or any other key for that matter. What happens if they're both pressed at the same time or a new key is added in to the equation?

newkeys = 40 (KEY_JUMP | KEY_SPRINT)
oldkeys = 0

newkeys - oldkeys = 40. if (40 == KEY_JUMP) is false. Now you miss the condition to detect it being pressed.

When dealing with bits you use bitwise & (AND) or | (OR). If you use arithmetic you won't be testing individual bits but combinations of bits.
Reply


Messages In This Thread
[HELP] What am i doing wrong (GetPlayerKeys) - by Dirty_bum - 25.09.2009, 02:24
Re: [HELP] What am i doing wrong (GetPlayerKeys) - by Toribio - 25.09.2009, 02:46
Re: [HELP] What am i doing wrong (GetPlayerKeys) - by Dirty_bum - 25.09.2009, 03:09
Re: [HELP] What am i doing wrong (GetPlayerKeys) - by Stepashka - 25.09.2009, 07:29
Re: [HELP] What am i doing wrong (GetPlayerKeys) - by Kalcor - 25.09.2009, 07:45
Re: [HELP] What am i doing wrong (GetPlayerKeys) - by Stepashka - 25.09.2009, 08:03
Re: [HELP] What am i doing wrong (GetPlayerKeys) - by Kalcor - 25.09.2009, 08:53
Re: [HELP] What am i doing wrong (GetPlayerKeys) - by Stepashka - 25.09.2009, 09:25

Forum Jump:


Users browsing this thread: 1 Guest(s)