1.I have defined a terrain for my FPS,added atomiser and that giant thing to it. Using the code in a collision/Mouse control tutorial, I cannot use arrow keys to move around. I disabled the collision command ( //dbAutomaticCameraCollision(0,2,1); ), so then I could move around by using arrow keys. But consequently, I could move in and out of the terrain and object boundries. How can I solve this?
2.How can I fire bullets using atomiser?
3.How can I get the enemy object to shoot at me?
Cheers
VB
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
int fCameraAngleX;
int fCameraAngleY;
void mouse(void);
// the main entry point for the application is this function
void DarkGDK ( void )
{
dbAutoCamOff();
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetCameraRange ( 1.0f, 30000.0f );
dbLoadImage ( "Mars.jpg", 1 );
dbLoadImage ( "detail.jpg", 2 );
dbSetupTerrain ( );
dbMakeObjectTerrain ( 1 );
dbSetTerrainHeightMap ( 1, "Map2.bmp" );
dbSetTerrainScale ( 1, 3.0f, 0.6f, 3.0f );
dbSetTerrainLight ( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
dbSetTerrainTexture ( 1, 1, 2 );
dbBuildTerrain ( 1 );
dbLoadObject ( "skybox2.x", 2 );
dbSetObjectLight ( 2, 0 );
dbScaleObject ( 2, 30000, 30000, 30000 );
//dbPositionCamera ( 0, 0, 0 );
dbLoadObject("Atomiser.x",10);
dbLoadObject("Bezerker.x",20);
//dbAutomaticCameraCollision(0,2,1);
//dbMakeObjectCube(2,10);
//dbPositionObject(2,50,10,100);
//dbSetObjectCollisionToBoxes ( 2 );
dbPositionObject(20,100,0,100);
dbRotateObject(20,-90,180,0);
dbRotateObject(10,-90,0,0);
dbPositionObject(10,10,-15,20);
dbLockObjectOn(10);
dbSetObjectCollisionToPolygons ( 20 );
// our main loop
while ( LoopGDK ( ) )
{
mouse();
dbMakeMatrix(4,100,100,10,10);
//dbControlCameraUsingArrowKeys ( 0, 2.0f, 2.0f );
//float fHeight = dbGetTerrainGroundHeight ( 1, dbCameraPositionX ( ),
//dbCameraPositionZ ( ) );
//dbPositionCamera ( dbCameraPositionX ( ), fHeight + 10.0f,
//dbCameraPositionZ ( ) );
//dbUpdateTerrain ( );
dbSync ( );
}
// return back to windows
return;
}
void mouse(void)
{
if (dbUpKey())
{
dbMoveCamera(2);
}
if (dbDownKey())
{
dbMoveCamera(-2);
}
if (dbLeftKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) - 90 );
dbMoveCamera(2);
}
if (dbRightKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) + 90 );
dbMoveCamera(2);
}
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.2f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.2f );
// rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
}