ok, i have a crosshair which is operated by a mouse click, i have a muzzle flash type thing that i want to operate by a certain key combination ( shift key and mouse click) just to hide that image until teh combo is pressed, i used dbSetAlphaMappingOn. the object i want to make work with the combo is (19). heres the code so far
if(dbMouseClick() == 1) // this is the code that needs to be change
{
dbSetCameraFOV( 0 , 57.0f) ; //zoom Camera
dbPasteImage ( 100 , ( dbScreenWidth( ) / 2 ) - 16 , ( dbScreenHeight( ) / 2 ) - 16 , 1 );
dbLoadImage("crosshairzoom.png",101);
dbPasteImage ( 101 , ( dbScreenWidth( ) / 2 ) - 16 , ( dbScreenHeight( ) / 2 ) - 16 , 1 );
dbShowObject(17);//show muzzleflash
dbShowObject(19);
}
if(dbMouseClick() == 2)//right click
{
dbSetCameraFOV( 0 , 43.0f) ; // default Camera
dbPasteImage ( 100 , ( dbScreenWidth( ) / 2 ) - 16 , ( dbScreenHeight( ) / 2 ) - 16 , 1 );
dbLoadImage("crosshairzoom.png",101);
dbPasteImage ( 101 , ( dbScreenWidth( ) / 2 ) - 16 , ( dbScreenHeight( ) / 2 ) - 16 , 1 );
dbShowObject(17);//show muzzleflash
dbShowObject(19);
}
else
{
dbPasteImage ( 100 , ( dbScreenWidth( ) / 2 ) - 16 , ( dbScreenHeight( ) / 2 ) - 16 , 1 );
}
if(dbKeyState(42))
{dbLoadImage("AKS.png",50);
dbPasteImage ( 50 , ( dbScreenWidth( ) / 2 ) - 105 , ( dbScreenHeight( ) / 2 ) - 60 , 1 );
dbSetCameraFOV( 0 , 43.0f) ;
dbHideObject(1);
dbHideObject(9);
dbHideObject(100);
dbPitchCameraDown(16.5);
dbTurnObjectLeft(50,20);
dbSetAlphaMappingOn(19,100);
}
else
{
dbSetAlphaMappingOn(100,0);
dbShowObject(1);
dbShowObject(9);
dbShowObject(100);
dbSetAlphaMappingOn(19,0);
}
//Player Controls
if (dbKeyState(31))
// W Move Forward
dbMoveObject (1,.47);
if (dbKeyState(32)) // A straffe left
dbMoveObjectLeft(1,.27);
if (dbKeyState(30)) // D straffe Right
dbMoveObjectRight(1,.27);
if (dbKeyState(17)) // S Move Back
dbMoveObject(1,-.47);
if(dbKeyState(17) == 0 )//stand still
dbLoopObject(1,0,0);
if(dbKeyState(17) == 1 )//walk forward
dbLoopObject(1,92,128);
if(dbKeyState(30) == 1 && dbKeyState(17) == 0 )//move sideways-left
dbLoopObject(1,92,128);
dbText( 0,0,"Use W/A/S/D to move, Shift to run and Zoom into ironsights" );
dbText( 0,20,"Right click for regular zoom and shoot, left click to return to normal and shoot" );
dbText( 0,40,"no collision,bullets,muzzle flashes,sounds or strafing animation yet" );
dbText( 0,60,"SimHood Productions" );
dbText( 0,80,"press escape to quit" );
// update the screen
dbSync ( );
}
// return back to windows
return;