I have a varialble that holds a sprite number for the bullet but its the Ship that the player controls that disaperes.
here is the code for the whole game
#include "DarkGDK.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
//Flags**************************//
bool GameStarted = false; //
bool GameOver = false; //
bool Moving = false; //
bool ShipMoving = false; //
bool Fireing = false; //
//*******************************//
bool TimeGot;
//Time Variables*********//
float CurrTime; //
float Time; //
//
Time = dbTimer(); //
//
int Second = 0; //
int Minute = 0; //
int Hour = 0; //
//***********************//
//Ship Varialbes*******************//
float ShipStartSpeed = 0; //
float ShipCurrSpeed = 0; //
float ShipMaxSpeed = 10; //
float ShipX = 20; //
float ShipY = 20; //
float Score = 0; //
float ShipRotation = 0; //
float ShipShield = 650; //
float ShipShownShield = 150; //
int BulletCount = 51; //
int CurrBulletCount = 51; //
int FireRate = 300;
float CurrBulletTime = 0;
float BulletTime = 0;
//*********************************//
// Frame rate and window setup*************//
dbSyncOn ( ); //
dbSyncRate ( 60 ); //
dbSetWindowSize(1024,768); //
dbSetImageColorKey(255,255,255); //
//*****************************************//
// Curser*********************************//
dbLoadImage("AsteroidsCurser.bmp",3); //
dbHideMouse(); //
//****************************************//
// Start Screen*************************//
dbLoadImage("AsteroidsStartPage.bmp",1);//
dbSprite(1,0,0,1); //
dbScaleSprite(1,63); //
//
// Start BTN //
dbLoadImage("StartBtn.bmp",2); //
dbSprite(2,308,100,2); //
//**************************************//
//Asteroids*************************************//
dbLoadImage("AsteroidPrime1.bmp",11); //
dbLoadImage("AsteroidPrime2.bmp",12); //
dbLoadImage("AsteroidSub1.bmp",13); //
dbLoadImage("AsteroidSub2.bmp",14); //
// Ship*****************************************//
dbLoadImage("AsteroidsShipFinal.bmp",4); //
dbSprite(4,ShipX,ShipY,4); //
dbOffsetSprite(4,dbSpriteWidth(4) / 2, //
dbSpriteHeight(4) / 2); //
//
//ShipShield************************************//
dbLoadImage("AsteroidsShield.bmp",5); //
dbSprite(5,ShipX,ShipY,5); //
dbOffsetSprite(5,dbSpriteWidth(5) / 2, //
dbSpriteHeight(5) / 2); //
dbHideSprite(5); //
//ShipBullet************************************//
dbLoadImage("AsteroidsBullet.bmp",50);
//dbSprite(50,70,70,50);
//dbScaleSprite(50,20);
//dbOffsetSprite(50,dbSpriteHeight(50) / 2,
//dbSpriteWidth(50) / 2);
//dbHideSprite(50);
//**********************************************//
// our main loop
while ( LoopGDK ( ) )
{
CurrTime = dbTimer();
dbScaleSprite(4,20);
if ( GameStarted == false )
{
dbHideSprite(4);
}
dbSprite(3,dbMouseX(),dbMouseY(),3);
if ( dbSpriteCollision(2,3) && dbMouseClick())
{
GameStarted = true;
dbHideSprite(1);
dbHideSprite(2);
}
if ( GameStarted == true)
{
dbText(10,10,"The game has started");
dbText(10,25,"Score:");
dbText(60,25,dbStr(Score));
dbShowSprite(4);
dbHideSprite(3);
}
if ( ShipCurrSpeed != 0)
{
ShipMoving = true;
}
else
{
ShipMoving = false;
}
//MoveShip********************************************//
if ( dbUpKey() && ShipStartSpeed < 10 )
{
if ( CurrTime > Time + 10)
{
ShipStartSpeed += .2;
}
}
if( dbUpKey() != 1 && ShipCurrSpeed > 0)
{
ShipStartSpeed -= .01;
}
if ( ShipMoving == true )
{
dbMoveSprite(4,ShipCurrSpeed);
}
if(ShipStartSpeed < 0)
{
ShipStartSpeed = 0;
}
ShipCurrSpeed = ShipStartSpeed;
dbText(50,300,dbStr(ShipCurrSpeed));
dbText(50,350,dbStr(ShipStartSpeed));
ShipX = dbSpriteX(4);
ShipY = dbSpriteY(4);
if( ShipX > 640 )
{
ShipX = 0;
dbSprite(4,ShipX,ShipY,4);
}
if( ShipX < 0 )
{
ShipX = 640;
dbSprite(4,ShipX,ShipY,4);
}
if( ShipY > 510)
{
ShipY = 0;
dbSprite(4,ShipX,ShipY,4);
}
if( ShipY < 0 )
{
ShipY = 510;
dbSprite(4,ShipX,ShipY,4);
}
dbText(100,100,dbStr(ShipY));
dbText(100,150,dbStr(ShipX));
//*****************************************************
//ShipShield***********************************************//
if ( dbDownKey() && ShipShownShield > 0 ) //
{ //
dbSprite(5,dbSpriteX(4),dbSpriteY(4),5); //
dbShowSprite(5); //
} //
else //
{ //
dbHideSprite(5); //
} //
//
dbBox(500,5,ShipShield,10); //
dbText(500,15,"Shield:"); //
dbText(560,15,dbStr(ShipShownShield)); //
//
if(dbDownKey() == 1) //
{ //
ShipShownShield -= .2; //
ShipShield -= .2; //
} //
else //
{ //
if ( ShipShield < 650) //
{ //
ShipShield += .1; //
ShipShownShield += .1; //
} //
} //
if( ShipShownShield < 0) //
{ //
ShipShownShield = 0; //
} //
if(ShipShownShield > 150) //
{ //
ShipShownShield = 150; //
} //
if(ShipShield < 500 ) //
{ //
ShipShield = 501; //
} //
if(ShipShield > 650 ) //
{ //
ShipShield = 650; //
} //
//
if ( ShipShownShield == 0) //
{ //
dbHideSprite(5); //
} //
//
//*********************************************************//
//ShipRotation*******************************//
//@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@//
//ShipRotateLeft*****************************//
if(dbLeftKey()) //
{ //
dbRotateSprite(4,ShipRotation); //
ShipRotation -= 6; //
} //
//
//ShipRotateRight****************************//
if(dbRightKey() ) //
{ //
dbRotateSprite(4,ShipRotation); //
ShipRotation += 6; //
} //
//
//*******************************************//
//ShipBullet*******************************************//
BulletTime = CurrTime;
if(TimeGot == false)
{
CurrBulletTime = dbTimer();
TimeGot = true;
}
if ( BulletTime - CurrBulletTime >= FireRate)
{
dbSprite(BulletCount,dbSpriteX(4),dbSpriteY(4),10);
TimeGot = false;
BulletCount++;
}
dbText(200,200,dbStr(CurrBulletTime));
dbText(200,250,dbStr(BulletTime));
//**********************************************************
//Asteroids************************************************//
// Timer*************************************//
dbText(60,60,dbStr(CurrTime));
dbText(80,80,dbStr(Time));
dbText(300,20,"Seconds:");
dbText(370,25,dbStr(Second));
dbText(300,40,"Minutes:");
dbText(370,40,dbStr(Minute));
if ( GameStarted == true)
{
if ( CurrTime > Time + 1000)
{
Second++;
Time = CurrTime;
}
if ( Second == 60 )
{
Minute++;
Second = 0;
}
}
//***************************************//
// update the screen
dbSync ( );
}
// return back to windows
return;
}
and thanks so much for your help
All is revealed with time.