I'm using this code to move the player using WASD or arrow keys
Notice that pl is my player object.
void Movement(Object pl)
{
// Up or W
if ( dbUpKey() || dbKeyState( 17 ) == 1 )
{
pl.MoveForward(0.5f);
}
// Down or s
if ( dbDownKey() || dbKeyState( 31 ) == 1 )
{
pl.MoveBackward(0.5f);
}
// Left or A
if ( dbLeftKey() || dbKeyState( 30 ) == 1 )
{
pl.RotateLeft(2);
}
// right or D
if ( dbRightKey() || dbKeyState( 32 ) == 1 )
{
pl.RotateRight(2);
}
dbPositionCamera(pl.getPositionX(),pl.getPositionY()+3,pl.getPositionZ());
dbSetCameraToObjectOrientation(pl.id);
dbMoveCamera(-10.0f);
}
Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.