yeah i worked some stuff out i incorporated some of that stuff and then added some other stuff like a counters and several other forms to pop out if you could just take a peak at this
#include "DarkGDK.h"
int score = 0;
enum eMode { eGameSetup, eGameMenu, eGameLevel1 };
eMode g_eGameMode = eGameSetup;
// the level we are currently on
int g_iLevel = 1;
/* we will use this to store the time we started and later
use it for the game time*/
int g_iLevelStartTime = 0;
void gameSetup ( void )
{
// set screen to a 1024 x 768 screen with 32 bit depth
dbSetDisplayMode (1024, 768, 32);
// Turn sync on
dbSyncOn();
// 60 frame per second
dbSyncRate(60);
//Full screen mode
dbMaximiseWindow();
// This just makes the mx and my equal to the current postion of the mouse
// This makes a color invisable (ONLY BITMAP WORKS FOR THIS)
dbSetImageColorKey(255, 0, 255);
// Load Mouse Image and hide the arrow
dbLoadImage("Assets\\mouse pointer.bmp", 1);
//dbHideMouse();
// Load Background Image and its Sprite then size it
dbLoadImage("Assets\\background.jpg", 2);
// Load Button images and Sprites
dbLoadImage("Assets\\play.png", 3);
dbLoadImage("Assets\\options.png",4);
dbLoadImage("Assets\\exit.png", 5);
// Load the playing surface
dbLoadImage("Assets\\table.bmp",6);
//Set Up animations
dbCreateAnimatedSprite(7,"Assets\\bro1cycle.bmp",3,1,7);
dbCreateAnimatedSprite(8,"Assets\\bro2cycle.bmp",3,1,8);
dbCreateAnimatedSprite(9,"Assets\\bro3cycle.bmp",3,1,9);
// The Victory sound
dbLoadSound("Assets\\We Are the Champions.wav",1);
// Switch the game mode to the Main Menu
g_eGameMode = eGameMenu;
}
void gameMenu (void)
{
int mx = dbMouseX();
int my = dbMouseY();
dbSprite(2, 0, 0, 2);
dbSprite(3, 0, 300, 3);
dbSprite(4, 0, 440, 4);
dbSprite(5, 0, 550, 5);
dbSprite(1,mx,my,1);
if (dbSpriteCollision(1,3))
{
if (dbMouseClick())
{
dbDeleteSprite(2);
dbDeleteSprite(3);
dbDeleteSprite(4);
dbDeleteSprite(5);
g_eGameMode = eGameLevel1;
}
}
}
void level1 (void)
{
bool click = false;
int score = 0;
int hole;
int bro;
dbRandomize(dbTimer());
hole = dbRND(2);
bro = dbRND(2);
// This is the intial time
int init = dbTimer();
while (g_eGameMode == eGameLevel1)
{
// this is the counter
int Time = (dbTimer() - init)/ 1000;
// use this to change a int ti a string
char str[200];
sprintf_s (str, 200, "Score : %d", score );
dbText ( 512, 10, str );
char time[200];
sprintf_s (time, 200, "Timer : %d",Time);
dbText (700, 10, time);
if (hole == 0 && bro == 0)
{
dbSprite(7,200,87,7);
if (dbSpriteFrame(7) < 3) dbPlaySprite(7,1,3,60);
}
if (hole == 1 && bro == 0)
{
dbSprite(7,300,87,7);
if (dbSpriteFrame(7) < 3) dbPlaySprite(7,1,3,60);
}
if (hole == 2 && bro == 0)
{
dbSprite(7,400,87,7);
if (dbSpriteFrame(7) < 3) dbPlaySprite(7,1,3,60);
}
if (hole == 0 && bro == 1)
{
dbSprite(8,200,87,8);
if (dbSpriteFrame(8) < 3) dbPlaySprite(8,1,3,60);
}
if (hole == 1 && bro == 1)
{
dbSprite(8,300,87,8);
if (dbSpriteFrame(8) < 3) dbPlaySprite(8,1,3,60);
}
if (hole == 2 && bro == 1)
{
dbSprite(8,400,87,8);
if (dbSpriteFrame(8) < 3) dbPlaySprite(8,1,3,60);
}
if (hole == 0 && bro == 2)
{
dbSprite(9,200,87,9);
if (dbSpriteFrame(9) < 3) dbPlaySprite(9,1,3,60);
}
if (hole == 1 && bro == 2)
{
dbSprite(9,300,87,9);
if (dbSpriteFrame(9) < 3) dbPlaySprite(9,1,3,60);
}
if (hole == 2 && bro == 2)
{
dbSprite(9,400,87,9);
if (dbSpriteFrame(9) < 3) dbPlaySprite(9,1,3,60);
}
// Select a new hole and reset animation when sprite has reached end of animation cycle
if (dbSpriteFrame(7) < 3) dbPlaySprite(7,1,3,60);
dbSprite(6, 150, 150, 6);
int mx = dbMouseX();
int my = dbMouseY();
dbSprite(1,mx,my,1);
if (dbSpriteCollision(1,7) || dbSpriteCollision(1,8) || dbSpriteCollision(1,9))
{
if (dbMouseClick())
{
click = true;
}
else
{
if (click)
{
click = false;
score += 1;
// Select a new hole and reset animation when player hit the sprite
bro = dbRND(2);
hole = dbRND(2);
dbSetSpriteFrame(7,0);
}
}
}
if (score == 10)
{
dbPlaySound(1);
g_eGameMode = eGameMenu;
}
dbSync();
}
}
// the game loop
void game ( void )
{
/* let us find out what game mode we are in and call the correct
routine. From here we can easily see all the differant parts of the game. */
switch ( g_eGameMode )
{
// The initial setup of the game
case eGameSetup:
gameSetup(); break;
// Display the main menu
case eGameMenu:
gameMenu(); break;
// Level 1
case eGameLevel1:
level1(); break;
}
}
// The Main Loop
void DarkGDK( void )
{
dbRandomize(dbTimer());
// the Main GDK Loop
while ( LoopGDK() )
{
// the game itself
game();
// this will wait for the screen to finish drawing, and then draw our whole sceen
dbSync();
}
}
, its the whole code let me kno wat you see plz