Posted By: warkarma
Sound in lite-c is the biggest problem !!! - 05/25/09 17:03
Hi all again. I have some more problems like always. I am trying to make sound work in Lite-C but it just doesn't work right. The thing i am trying to do is to make left mouse button shut bullets (a lot of them nonstop) and the right mouse button to explode 1 time a sec. And then i press left mouse button in the beginning it sound goes only one time and after a few moments it start working the way i want it to work but then i try to press right mouse button the explosion doesn't work, but then i hold right mouse button the sound starts working properly but the bullet sound doesn't work again. Anyway try it for your self and if you know the answer how to fix this problem please let me know.
download from here:
http://rapidshare.com/files/237116491/Sound.rar.html
or
http://rapidshare.com/files/237116918/Sound.rar.html
the code:
#include <acknex.h>;
#include <default.c>;
BMAP* sight_png = "sight.png";
SOUND* shoot_wav = "gun_1.wav";
SOUND* explode_wav = "explode.wav";
function gunsound();
function gunsound()
{
while(1)
{
if(mouse_left)
{
snd_play(shoot_wav, 30, 1);
wait(-0.1);
}
if(mouse_right)
{
snd_play(explode_wav,30,-1);
wait(-1);
}
wait(1);
}
}
function main()
{
screen_size.x = 800; // set the screen size
screen_size.y = 600;
video_screen = 2; // Window mode
mouse_spot.x = bmap_width(sight_png) /2; // sets the mouse spot
mouse_spot.y = bmap_height(sight_png)/2;
mouse_map = sight_png; // mouse bitmap
mouse_mode = 1; //mouse mode
gunsound();
while(1)
{
vec_set(mouse_pos,mouse_cursor);
wait(1);
}
} // end main
Thank you for your time
download from here:
http://rapidshare.com/files/237116491/Sound.rar.html
or
http://rapidshare.com/files/237116918/Sound.rar.html
the code:
#include <acknex.h>;
#include <default.c>;
BMAP* sight_png = "sight.png";
SOUND* shoot_wav = "gun_1.wav";
SOUND* explode_wav = "explode.wav";
function gunsound();
function gunsound()
{
while(1)
{
if(mouse_left)
{
snd_play(shoot_wav, 30, 1);
wait(-0.1);
}
if(mouse_right)
{
snd_play(explode_wav,30,-1);
wait(-1);
}
wait(1);
}
}
function main()
{
screen_size.x = 800; // set the screen size
screen_size.y = 600;
video_screen = 2; // Window mode
mouse_spot.x = bmap_width(sight_png) /2; // sets the mouse spot
mouse_spot.y = bmap_height(sight_png)/2;
mouse_map = sight_png; // mouse bitmap
mouse_mode = 1; //mouse mode
gunsound();
while(1)
{
vec_set(mouse_pos,mouse_cursor);
wait(1);
}
} // end main
Thank you for your time