At the moment i have my scope appearing on screen but im not sure how to make the white centre transparent at the moment heres my code:
#include "DarkGDK.h"
// the main entry point for the application is this function
int fCameraAngleX;
int fCameraAngleY;
void mouse(void);
void fred (void);
void muzzle (void);
void DarkGDK ( void )
{
dbAutoCamOff();
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetWindowOff ( );
dbHideMouse ( );
dbSetImageColorKey (0,0,0);
dbLoadObject("AR10B.x",10);
dbLoadImage ("gunfire1.png", 100);
dbLoadImage ("texture.jpg",1);
dbLoadImage ("detail.jpg",2);
dbLoadObject ("Assualt Trooper.x",604);
dbLoadSound ("Gun shot 3.wav", 690);
dbLoadImage ("sight.png",970);
dbMakeObjectBox( 11, 100 , 100, 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
dbPositionObject (11,-70,-7,730);
dbMoveObjectLeft (11,26.0f);
dbMoveObjectDown (11, 8.0f);
dbLockObjectOn( 11 );//Always lock it on
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,0,80,0);
dbPositionObject (10,-10,-90,210);
dbLockObjectOn(10);
dbLockObjectOn (100);
dbPositionCamera (140,23,100);
// our main loop
while ( LoopGDK ( ) )
{
fred ( );
mouse( );
muzzle( );
dbMakeMatrix(4,100,100,10,10);
// update the screen
dbSync ( );
}
// return back to windows
return;
}
void mouse(void)
{
if (dbUpKey())
{
dbMoveCamera(0.2);
}
if (dbDownKey())
{
dbMoveCamera(-0.2);
}
if (dbLeftKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) - 90 );
dbMoveCamera(0.2);
}
if (dbRightKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) + 90 );
dbMoveCamera(0.2);
}
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.2f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.2f );
// rotate camera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
}
void fred (void)
{
float ground_height = dbGetTerrainGroundHeight (1,dbCameraPositionX(), dbCameraPositionZ());
dbPositionCamera (dbCameraPositionX(), ground_height + 6.0f, dbCameraPositionZ());
}
void muzzle (void)
{
if (dbMouseClick() == 2)
{
dbSetCameraFOV (0,25.0f);
dbPasteImage (970,0,0,1);
}
else
{
dbSetCameraFOV (0,62.0f);
dbHideObject (970);
}
if ( dbMouseClick() == 1)//If left mouse button is pressed
{
dbShowObject(11);//show muzzleflash
dbRollObjectLeft ( 11 , (float)(rand() % 360) );
dbPlaySound(690);//Play gun sound
dbLoopSound(690,0,10000,0);//Loop it again and again
}
else//otherwise
{
dbHideObject(11);//hide muzzleflash
dbPauseSound (690);
}
}
Any help would be 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"