Hey guys
So i created a menu to my game
Here it is:
void Menu()
{
mx = dbSpriteX(10);
my = dbSpriteY(10);
if (mx >= 250 && mx <= 550 && my >= 200 && my <=250 && dbMouseClick())
{
menu = false;
}
if (mx >= 250 && mx <= 550 && my >= 290 && my <=350 && dbMouseClick())
{
return;
}
}
Here's my DarkGDK void:
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
load();
if (menu == true)
{
dbSprite(600, 0, 0, 600);
dbSprite(10, dbMouseX(), dbMouseY(), 10);
Menu();
}
dbSprite(1, 0, 0, 1);
dbSprite(player, 0, 320, player);
dbSprite(2, 0, 460, 2); //water
// Control Panel
dbSprite(201, 280, 30, 201);
dbSprite(202, 322, 30, 202);
dbSprite(203, 362, 30, 203);
dbSprite(204, 402, 30, 204);
dbSprite(349, 475, 0, 349);
defense1 = 0;
defense2 = 0;
defense3 = 0;
defense4 = 0;
generate();
dbSetWindowTitle("Island Defender");
while ( LoopGDK ( ) )
{
//if (menu)
//{
// Menu();
//}
//else
//{
if (dbKeyState(25) && (dbTimer() > timer + 500))
{
timer = dbTimer();
if (!isPaused) // If we are not paused
isPaused = true; // then pause the game...
else // But if we are
isPaused = false; // Un-pause the game
}
// }
if (isPaused) {
dbSprite(99, 0, 0, 99);
} else {
// Boat Speed and Bomb Speed Record
std::ofstream speed("ID.ai");
speed << "Trashco Studios - Island Defender" << "\n";
speed << "BombSpeed : " << bombspeed << "\n";
speed << "Boat Speed : " << boatspeed << "\n";
speed.close();
if (gold < 0) {gold = 0;}
dbDeleteSprite(99);
input();
display();
generate();
cheats();
bomb();
collision();
Round();
Buy();
Shield();
if(!dbSpriteExist(5))
{
shooting = false;
}
if(dbEscapeKey() == 1)
{
break;
return;
}
}
dbSync ( );
}
return;
}
I know its very big, but dont need to read all..
i Just want to show the menu at the beggining and then if the user click on Start game (the x and y are in void Menu) they start the game..
Thanks
C++ Medium 3.5/5
VB6 Advanced: 4/5
VB.NET Advanced: 4/5