How to achieve smooth movement from keyboard???
Posted 18 September 2005 - 09:58 AM
Posted 18 September 2005 - 10:32 AM
the problem (i guess) is that you use a switch and break after your cases. in the code you posted at gamedev, you check for up, and break out of it while not checking other cases, so if you press both up and left you don't move diagonal but only in the up direction. like people said on gamedev, use ifs and check all combinations.
Posted 19 September 2005 - 02:47 AM
if( key == GLUT_KEY_UP ) b += 5.5f; if( key == GLUT_KEY_DOWN ) b -= 5.5f; if( key == GLUT_KEY_LEFT ) a -= 5.5f; if( key == GLUT_KEY_RIGHT ) a += 5.5f;
Posted 19 September 2005 - 02:31 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users