1st. When i run the program the character starts outside of where i want him any ideas how to fix this ? Its a FPS
#include "DarkGDK.h"
#include "SC_Collision.h"
// the main entry point for the application is this function
int fCameraAngleX;
int fCameraAngleY;
void mouse ( void );
void bob ( void );
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetCameraRange (0.5f, 30000);
dbHideMouse ( );
dbLoadObject("Atomiser.x",10);
dbDisableObjectZDepth(10);
dbLoadImage("texture.jpg", 1);
dbLoadImage("detail.jpg", 2);
dbSetupTerrain ();
dbMakeObjectTerrain (1);
dbSetTerrainHeightMap (1,"Map.bmp");
dbSetTerrainScale (1,3,0.6f,3);
dbSetTerrainSplit (1,16);
dbSetTerrainTiling (1,4);
dbSetTerrainLight (1,1.0f,-0.25f,0.0f,1,1,0.78f,0.5f);
dbSetTerrainTexture (1,1,2);
dbBuildTerrain (1);
dbRotateObject(10,-90,0,0);
dbPositionObject(10,10,-15,20);
dbLockObjectOn(10);
dbLoadImage("gunfire1.png",100,0);
dbMakeObjectBox( 11, 4 , 4, 0 );//First make a box
dbTextureObject( 11 , 100 );
dbFadeObject( 11, 8000 );
dbSetObjectTransparency( 11 , 1 );
dbHideObject( 11 );//Hide it when not in use
dbSetObjectCollisionOff( 11 );//No need for collision
//This basically handles the positioning of the muzzleflash
dbMoveObjectRight( 11 , 1.85f);
dbMoveObject( 11 , 8 );
dbMoveObjectDown( 11 , 1.3f);
dbLockObjectOn( 11 );//Always lock it on
dbLoadSound("Colt 45_Imitation Shot.wav",21);//Load a gun sound, id is 21
dbSetSoundSpeed(21,88000);
// our main loop
while ( LoopGDK ( ) )
{
mouse ( );
bob ( );
dbMakeMatrix(4,100,100,10,10);
// update the screen
dbSync ( );
//First you make the camera formula here
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.2f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.2f );
// rotate camera in our game
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
if ( dbMouseClick() == 1)//If left mouse button is pressed
{
dbPlaySound(21);//Play gun sound
dbLoopSound(21,0,10000,0);//Loop it again and again
dbShowObject(11);//show muzzleflash
dbRollObjectLeft ( 11 , (float)(rand() % 360) );
}
else//otherwise
{
dbPauseSound(21);//pause gun sound
dbHideObject(11);//hide muzzleflash
}
}
// exit the program
return;
}
void bob ( void )
{
float ground_height = dbGetTerrainGroundHeight (1,dbCameraPositionX(), dbCameraPositionZ());
dbPositionCamera (dbCameraPositionX(), ground_height + 6.0f, dbCameraPositionZ());
}
void mouse ( void )
{
if (dbUpKey())
{
dbMoveCamera(0.5);
}
if (dbDownKey())
{
dbMoveCamera(-0.5);
}
if (dbLeftKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) - 90 );
dbMoveCamera(0.5);
}
if (dbRightKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) + 90 );
dbMoveCamera(0.5);
}
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.2f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.2f );
// rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
}
2nd. Im not sure how to do bullet detection and/or bullet marks in say a wall.
All files used except the sound file come with darkgdk
All help is appreciated
"Lifes like a box of chocolates, you never know which one you get" Forest Gump
Unless you read the leaflet, thats why hes so "different"