25.09.2009, 08:53
Quote:
Originally Posted by stepmex
All is considered
![]() |
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.