so. I have some bgt code. but, wen the g key is pressed, nothing works.
void game()
{
while(true);
{
if (key_pressed(KEY_G))
{
house();
}
if (key_pressed(KEY_Q)
{
EXIT();
}
}
Pages 1
You are not logged in. Please login or register.
AudioGames.net Forum → Developers room → why doesn't this work? bgt.
so. I have some bgt code. but, wen the g key is pressed, nothing works.
void game()
{
while(true);
{
if (key_pressed(KEY_G))
{
house();
}
if (key_pressed(KEY_Q)
{
EXIT();
}
}
First of all, you're showing one function called game, not main. Now, game can be a function but main has to be there too, and main needs to have the game window set up or it can't take keyboard focus. Second, when you're working with multiple conditionals like that, you need to use else if, not just two ifs side by side like that. Finally, you're missing a closing parenthesis on the second if statement.
First, we don't know what the main function looks like, so that could be part of the issue. Second, you're missing the second right paren on the second if statement, and third, on the second if, you'd want else if, not just if.
In the while loop, there should not be a ; or semi colon after the last )
it works now, thanks! @4.
AudioGames.net Forum → Developers room → why doesn't this work? bgt.
Generated in 0.016 seconds (49% PHP - 51% DB) with 11 queries