ok so basically I'm loading in a sound for the tank gun shot. The sound is definitely in the right place with all the other sounds, and the code is correct...but it's not loaded and now crashes every time I exit (doesn't without the line that loads the sound).
I tried using dbSoundExist and that returns 0.
the sound I'm trying to load is tankblast.wav, here's the main.cpp code
// 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"
#include "SC_Collision.h"
#include "player.h"
#include "camera.h"
#include "tanks.h"
#include "hud.h"
#include "collectibles.h"
#include "objects.h"
// the main entry point for the application is this function
int LoadLevel(int);
void position_collectibles();
void loop_collectibles();
void Create_Springs();
void looop();
void Load_Tanks();
void Loop_Tanks();
void DarkGDK ( void )
{
dbSetImageColorKey ( 255, 255,255 );
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbRandomize(5000);
SC_Start();
dbSetCameraRange(1,10000);
dbSetAmbientLight(0);
dbSetDisplayMode( GetSystemMetrics( 0 ), GetSystemMetrics( 1 ), 32 );
dbSetWindowOff();
dbHideMouse();
//dbSetNormalizationOn ( );
dbAutoCamOff();
dbColorBackdrop(dbRGB(0,0,0));
dbLoadImage("Media//textures//balltexture.jpg",1);
dbLoadSound("Media//sounds//coin.wav",1);
//dbLoadMusic("Media//sounds//supermarket.mp3",1);
dbLoadImage("Media//Textures//crosshair.png",4);
dbLoadSound("Media//sounds//gun2.wav",2);
dbLoadSound("Media//sounds//explosion.wav",3);
dbLoadImage("Media//Textures//bullet.png",5);
dbLoadImage("Media//Textures//gunfire1.png",11);
dbLoadImage("Media//Textures//green.jpg",12);
dbLoadSound("Media//sounds//tank_hit.wav",4);
dbLoadSound("Media//sounds//tankhit_2.wav",5);
dbLoadSound("Media//sounds//tankblast.wav",6); //this sound not loading
int level_num=0; //start level 0 (+1)
int hit=0;
extern float CamDistance;
extern float height;
extern int counter;
//make some bullet markers
for( int i=10002; i <= 10040; i++ )
{
dbMakeObjectPlain( i,3,3 );
dbSetAlphaMappingOn ( i, 0);
dbTextureObject( i,5);
dbSetObjectLight( i,0 );
dbHideObject( i );
}
LoadLevel(level_num); //load level
player player1; //class player
camera camera; //class camera
object spring[10];
Create_Springs();
player1.CreatePlayer(); //create player
position_collectibles(); //position coins
Load_Tanks();
dbSetObjectSpeed(1,10000);
// our main loop
while ( LoopGDK ( ) )
{
for (int i=50;i<55;i++){ //MAX SPRINGS
if (dbObjectCollision(1,i)){
height=6.0f;
dbPlayObject(i);}
if (dbObjectCollision(1,spring[i].objectID)==3)
{height=3.0f;}}
player1.shoot();
player1.PlayerAnimations();
player1.PlayerCollision(); //update player collision
camera.PositionCamera();
main_hud.Hud(); //update hud
loop_collectibles(); //loop coins (spin etc)
Loop_Tanks(); //loop enemy routines
/*char str [ 128 ];
sprintf_s( str, 128, "X: %f", dbObjectPositionX(1) ); dbText( 800,10,str );
sprintf_s( str, 128, "Y: %f", dbObjectPositionY(1) ); dbText( 800,30,str );
sprintf_s( str, 128, "Z: %f", dbObjectPositionZ(1) ); dbText( 800,50,str );
sprintf_s( str, 128, "FPS: %d", dbScreenFPS ( ) ); dbText( 800,70,str );
sprintf_s( str, 128, "camX: %f", dbCameraAngleX() ); dbText( 800,90,str );
sprintf_s( str, 128, "camY: %f", dbCameraAngleY() ); dbText( 800,110,str );
sprintf_s( str, 128, "camZ: %f", dbCameraAngleZ() ); dbText( 800,130,str );
sprintf_s( str, 128, "height: %f", height ); dbText( 800,150,str );
sprintf_s( str, 128, "polys: %d", dbStatistic(1) ); dbText( 800,170,str );*/
char str [ 128 ];
sprintf_s( str, 128, "FPS: %d", dbScreenFPS ( ) ); dbText( 800,70,str );
sprintf_s( str, 128, "exist: %d", dbSoundExist(6) ); dbText( 800,170,str );
// update the screen
dbSync ( );
}
// return back to windows
return;
}
can anyone help?
thanks