Hello All,
I am currently have trouble with my game and moving the camera with the W,A,S,D keys. I am rotating the camera with the mouse and using both at the same time is making the left and right movement crash out and stop moving.
Here is my code;
Also i am uploading the the complied level for you guys to see what it's doing.
#include "dinput.h"
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn();
dbSyncRate ( 60 );
//dbLoadObject ("littlemax.X",3);
dbAutoCamOff();
dbSetCameraRange ( 1, 10000 );
dbLoadObject ( "levelone.dbo",1 );
dbPositionCamera ( 0,50, 0 );
// camera variables
float fCameraAngleX = 0.0f;
float fCameraAngleY = 0.0f;
while ( LoopGDK() )
{
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.4f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.4f );
// rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
if ( dbKeyState ( DIK_W ) )
{
dbMoveCamera ( 1 );
}
if ( dbKeyState ( DIK_S ) )
{
dbMoveCamera ( -1 );
}
if ( dbKeyState ( DIK_A ) )
{
dbTurnCameraLeft ( 90 );
dbMoveCamera ( 1 );
dbTurnCameraRight ( 90 );
}
else if ( dbKeyState ( DIK_D ) )
{
dbTurnCameraRight ( 90 );
dbMoveCamera ( 1 );
dbTurnCameraLeft ( 90 );
}
dbSync();
}
return;
}
Don't forget, to move the camera use W,A.S.D key's and to rotate the camere use the mouse.
Thank you,
Here i am!!!