ok so heres the code lol
void Shoot(){
dbLoadImage("GunShot.png", 12);
dbMakeObjectBox (11, 7 , 7, 0);
dbPositionObject(11, dbObjectPositionX(1)-2, dbObjectPositionY(1)+8, dbObjectPositionZ(1)+24);
dbTextureObject (11 , 12);
dbSetObjectLight (11 , 0);
dbSetObjectEmissive(11 , 0x00646464);
dbSetObjectAmbience (11 , 0x00FFFFFF);
dbFadeObject(11, 8000);
dbSetObjectTransparency(11 , 1);
dbHideObject(11);
dbSetObjectCollisionOff(11);
dbLockObjectOn(11);
dbLoadSound("gun1.wav", 15);
dbPauseSound(15);
dbSetSoundSpeed(15,5000);
UpdateBullet();
if(bullets > 0){
if(dbMouseClick() == 1){
if(dbTimer() - ShootingTimer > 160){
if (BulletCount >= 30) {
BulletCount = 0;
}
bullets--;
Bullet();
dbPlaySound(15);
dbShowObject(11);
dbRollObjectLeft(11,(float)(rand() % 360));
dbShowLight(0);
dbPositionLight(0,dbObjectPositionX(11), dbObjectPositionY(11), dbObjectPositionZ(11));
}
}
}
if(bullets < 1){
dbText(200,400, "PRESS R TO RELOAD");
}
if (dbKeyState(19) == 1){
reload();
}
}
void reload(){
y = 30 - bullets;
for(int i = 0; i < y; i++){
bullets++;
}
}
void Bullet(){
for (int i = 0; i < 30; i++){
BULLET[i][1] = BulletCount;
dbMakeObjectSphere(BULLET[i][1]+300,3);
}
BULLET[BulletCount][3] = dbTimer();
BULLET[BulletCount][2] = 1;
BULLET[BulletCount][4] = 1400;
dbPositionObject(BULLET[BulletCount][1]+300, dbCameraPositionX()+5, dbCameraPositionY(), dbCameraPositionZ()+10);
dbXRotateObject(BULLET[BulletCount][1]+300, fCameraAngleX);
dbYRotateObject(BULLET[BulletCount][1]+300, fCameraAngleY);
dbPositionObject(BULLET[BulletCount][0]+300, dbCameraPositionX() + 5, dbCameraPositionY(), dbCameraPositionZ()+10);
dbXRotateObject(BULLET[BulletCount][0]+300, fCameraAngleX);
dbYRotateObject(BULLET[BulletCount][0]+300, fCameraAngleY);
BulletCount++;
}
void UpdateBullet(){
for (int i = 0; i < 30; i++){
if (dbObjectExist(BULLET[i][1]+300)){
dbMoveObject(BULLET[i][0]+300, BulletSpeed);
dbMoveObject(BULLET[i][1]+300, BulletSpeed);
}
}
}