Hello everyone,
I'm trying to develop a small game in BGT, in which I need to announce the row and column numbers of each cell when you use arrows to move in the grib. Something like 5, 8. The problem is with interrupting the numbers when the player is moving rapidly on the grid. My solution is this function I wrote that doesn't work very smoothly:
void PlayCell()
{
sound SayX, SayY;
SayX.load("Voices/" + x + ".wav");
SayY.load("Voices/" + y + ".wav");
SayX.play();
while (SayX.playing)
{
if (key_pressed(KEY_LEFT) || key_pressed(KEY_RIGHT) || key_pressed(KEY_UP) || key_pressed(KEY_DOWN))
{
SayX.stop();
return;
}
wait(5);
}
SayY.play();
while (SayY.playing)
{
if (key_pressed(KEY_LEFT) || key_pressed(KEY_RIGHT) || key_pressed(KEY_UP) || key_pressed(KEY_DOWN))
{
SayY.stop();
return;
}
wait(5);
}
}
Isn't there a better way? For example, isn't it possible to merge two sounds in one sound object? So for example, I can merge 5 and 8 to one sound object and play it without so much fuss?
Thanks in advance.
Cheers,
Meisam