#include "DarkGDK.h"
#include "sc_collision.h"
#define maxEnemyNumber 60
//global variables
int map = 1; //loading the map
int character = 2; //loading the character
int sphereCam = 3; //position in front of the player; uses the camera to rotate
float vx = 0; //where the player is the whole time
float vy = 0; // -"-
float vz = 0; // -"-
float gravity = -0.05f;
float slope = 0.5f;
float radius = 7.0f;
int ground = 1;
int jumptimer = 0;
bool Moving = false;
bool Running = false;
bool noClip = false;
bool PressingF1 = false;
bool mouseClicked = false;
//gun
int mainWeapon = 4;
int bullet = 5;
int bullets[20][5];
int bulletCounter = 0;
int shootingTimer = dbTimer();
int bulletVictim = 0;
int bulletSpeedTimer = dbTimer();
int crosshair =3;
//gun sounds
int gunShot = 1;
int m4Click = 2;
int currentAmmo = 40;
int maxM4Ammo = 40;
int remainingAmmo = 40;
bool reloading = false;
int reloadTimer = dbTimer();
//enemy
int enemyHolder[maxEnemyNumber][6];
int enHowLongChasing[maxEnemyNumber];
int enemyNumDisplay = 0;
int enemyCounter = 0;
int enemyHitCube[maxEnemyNumber];
int spawnTimer = dbTimer();
int spawnInterval = 5000;
//only necessary when starting UpdateEnemyGravity
float vxEN[maxEnemyNumber];
float vyEN[maxEnemyNumber];
float vzEN[maxEnemyNumber];
float groundEN[maxEnemyNumber];
int enLineOfSight[maxEnemyNumber];
int enLineOfSightBar[maxEnemyNumber];
int enLineOfSightBarTimer[maxEnemyNumber];
int enLineOfSightTimer[maxEnemyNumber];
bool initialTurn[maxEnemyNumber];
int enMovementUpdate[maxEnemyNumber];
int enIveBeenHitTimer[maxEnemyNumber];
bool enAttacking[maxEnemyNumber];
int enAttackTimer[maxEnemyNumber];
//animation
int animTimerEN[maxEnemyNumber];
int currentAnimationEN[maxEnemyNumber];
int enemyDeathSound = 9;
int elementWithinArray[maxEnemyNumber];
//characters
int myHealth = 100;
bool takingDmagae = false;
bool groanChosen = false;
int endOfGameTimer = dbTimer();
int myCollisionHitBox = 6;
int iveBeenHitTimer = dbTimer();
//sounds
int characterGroan1 = 3;
int characterGroan2 = 4;
int characterGroan3 = 5;
int characterGroan4 = 6;
int characterGroan5 = 7;
int characterDeathScream = 0;
int GroanToPlay;
bool gameOver = false;
int ammoDrops[5];
int ammoDropsState[5];
int maxAmmoPickups = 5;
int informationTimer = dbTimer();
bool ammoPickedUp = false;
this is the code with the issue
void loadMainCharacter(void)
{
dbMakeObjectBox(character, 30, 150, 30);//coordinates of the character's position
dbPositionObject(character, dbObjectPositionX(map), dbObjectPositionY(map)-600, dbObjectPositionZ(map));
SC_SetupObject(character, 1, 2);
dbHideObject(character);
dbMakeObjectSphere(sphereCam, 20);
dbScaleObject(sphereCam, .0001, .0001, .0001);//size of the camera
dbPositionObject(sphereCam, dbObjectPositionX(character), dbObjectPositionY(character)+50, dbObjectPositionZ(character));
//sounds when the soldier is hit
dbLoadSound("sounds//soldier//groan1.wav", characterGroan1);
dbLoadSound("sounds//soldier//groan2.wav", characterGroan2);
dbLoadSound("sounds//soldier//groan3.wav", characterGroan3);
dbLoadSound("sounds//soldier//groan4.wav", characterGroan4);
dbLoadSound("sounds//soldier//groan5.wav", characterGroan5);
dbLoadSound("sounds//soldier//death1.wav", characterDeathScream);
//collision hit box
dbMakeObjectBox(myCollisionHitBox, 30, 150, 30);
SC_SetupObject(myCollisionHitBox, 1, 2);//used to check collisions against enemies
dbHideObject(myCollisionHitBox);
}
and
while ( LoopGDK ( ) )
{
updateCamera(dbMouseMoveX(), dbMouseMoveY());
if(gameOver == false)
{
controlCharacter();
positionWeapons();
shootGun();
updateEnemyGravity();
updateEnemies();
updateEnemyAnimations();
infoDisplay();
inputKeys();
enemySpawner();
ammoPickup();
}
//update the screen
dbSync( );
}
return;
}