please help me with my bgt code.

hi. i have a problem in my code. i insert the prior and next as a background volume keys. but, the problem is, the volume is not working. and, there is a better way to do this in bgt?
sorry for my english. its not my native language.
here is my code.

#include "includes/key_hold.bgt"
double musvol;
int minvol=0;
int maxvol=100;
int volumespeed=70;
int keyspeed=300;
key_hold kprior(KEY_PRIOR,keyspeed,volumespeed);
key_hold knext(KEY_NEXT,keyspeed,volumespeed);
key_hold khome(KEY_HOME,keyspeed,volumespeed);
key_hold kend(KEY_END,keyspeed,volumespeed);
sound[] l(5);
sound[] b(5);
void main()
{
show_game_window("background and effects");
for (uint i=0; i<l.length(); i++)
l[i].load("sounds/l"+(i+1)+".ogg");
for (uint i=0; i<b.length(); i++)
{
b[i].load("sounds/b"+(i+1)+".ogg");
b[i].volume=musvol;
}
while(true)
{
if(key_pressed(KEY_1))
{
b[0].stop();
b[0].play();
}
if(key_pressed(KEY_2))
{
b[1].stop();
b[1].play();
}
if(key_pressed(KEY_3))
{
b[2].stop();
b[2].play();
}
if(key_pressed(KEY_4))
{
b[3].stop();
b[3].play();
}
if(key_pressed(KEY_5))
{
b[4].stop();
b[4].play();
}
if(key_pressed(KEY_Q))
{
l[0].stop();
l[0].play();
}
if(key_pressed(KEY_W))
{
l[1].stop();
l[1].play();
}
if(key_pressed(KEY_E))
{
l[2].stop();
l[2].play();
}
if(key_pressed(KEY_R))
{
l[3].stop();
l[3].play();
}
if(key_pressed(KEY_T))
{
l[4].stop();
l[4].play();
}
for (uint i=0; i<b.length(); i++)
{
if (kprior.pressing())
{
b[i].volume=b[i].volume+1;
}
if (knext.pressing())
{
b[i].volume=b[i].volume-1;
}
if(khome.pressing() and get_sound_master_volume()<0)
{
set_sound_master_volume(get_sound_master_volume()+1);
}
if(kend.pressing() and get_sound_master_volume()>-60)
{
set_sound_master_volume(get_sound_master_volume()-1);
}
}
if(key_pressed(KEY_ESCAPE))
{
exit();
}
}
}

thanks.



-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Yukie via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : cartertemm via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Yukie via Audiogames-reflector

Reply via email to