Changed TimerDraw Function Slightly for Readability

This commit is contained in:
Asrın Doğan 2019-09-13 21:02:16 +03:00
parent 23a49fa855
commit 477b4ddb40
2 changed files with 8 additions and 10 deletions

View File

@ -1,5 +1,5 @@
# SynGame
Simple Shoot 'Em Up game.
Simple Shoot 'Em Up game for Windows.
Keys:\
Move Up - Up Arrow\

View File

@ -667,14 +667,12 @@ void DrawTimer()
char digit;
Vector2D spawnPosition;
int i = -timerDigitLimit / 2;
spawnPosition = timerPosition;
/* while (processedScore >= 1 && i > 0) */
while (i < 0)
{
spawnPosition = timerPosition;
/* numberImageSize + 1 is because 1 pixel space between digits */
spawnPosition.x -= screenSizeMultiplier * (numberImageSize + 1) * i;
spawnPosition.x = timerPosition.x - screenSizeMultiplier * (numberImageSize + 1) * i;
digit = seconds % 10;
seconds = (int)(seconds / 10);
@ -682,18 +680,15 @@ void DrawTimer()
i++;
}
spawnPosition = timerPosition;
/* numberImageSize + 1 is because 1 pixel space between digits */
spawnPosition.x -= screenSizeMultiplier * (numberImageSize + 1) * i;
spawnPosition.x = timerPosition.x - screenSizeMultiplier * (numberImageSize + 1) * i;
DrawNumber(spawnPosition, colon);
i++;
while (i < (timerDigitLimit / 2) + 1)
{
spawnPosition = timerPosition;
/* numberImageSize + 1 is because 1 pixel space between digits */
spawnPosition.x -= screenSizeMultiplier * (numberImageSize + 1) * i;
spawnPosition.x = timerPosition.x - screenSizeMultiplier * (numberImageSize + 1) * i;
if(i == 0)
{
@ -857,8 +852,10 @@ void PlayerShoot()
shootDir.y = 0;
player.shootCooldown = 1 / (float)player.shootPerSecond;
bullets.bulletCount++;
bullets.bulletArray = (Bullet *) realloc(bullets.bulletArray, sizeof(Bullet) * bullets.bulletCount);
newBullet = (bullets.bulletArray + bullets.bulletCount - 1);
newBullet -> position = player.position;
newBullet -> position.x += offset;
@ -881,6 +878,7 @@ void EnemyShoot()
{
srand(time(0) + enemyRespawnCounter++);
enemy = (enemies.enemyArray + i);
if(enemy -> fireCooldown > 0.0)
enemy -> fireCooldown -= deltaTime;
else