Changed TimerDraw Function Slightly for Readability
This commit is contained in:
parent
23a49fa855
commit
477b4ddb40
|
@ -1,5 +1,5 @@
|
||||||
# SynGame
|
# SynGame
|
||||||
Simple Shoot 'Em Up game.
|
Simple Shoot 'Em Up game for Windows.
|
||||||
|
|
||||||
Keys:\
|
Keys:\
|
||||||
Move Up - Up Arrow\
|
Move Up - Up Arrow\
|
||||||
|
|
16
SynGame.c
16
SynGame.c
|
@ -667,14 +667,12 @@ void DrawTimer()
|
||||||
char digit;
|
char digit;
|
||||||
Vector2D spawnPosition;
|
Vector2D spawnPosition;
|
||||||
int i = -timerDigitLimit / 2;
|
int i = -timerDigitLimit / 2;
|
||||||
|
spawnPosition = timerPosition;
|
||||||
|
|
||||||
/* while (processedScore >= 1 && i > 0) */
|
|
||||||
while (i < 0)
|
while (i < 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
spawnPosition = timerPosition;
|
|
||||||
/* numberImageSize + 1 is because 1 pixel space between digits */
|
/* 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;
|
digit = seconds % 10;
|
||||||
seconds = (int)(seconds / 10);
|
seconds = (int)(seconds / 10);
|
||||||
|
@ -682,18 +680,15 @@ void DrawTimer()
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
spawnPosition = timerPosition;
|
|
||||||
/* numberImageSize + 1 is because 1 pixel space between digits */
|
/* 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);
|
DrawNumber(spawnPosition, colon);
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
while (i < (timerDigitLimit / 2) + 1)
|
while (i < (timerDigitLimit / 2) + 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
spawnPosition = timerPosition;
|
|
||||||
/* numberImageSize + 1 is because 1 pixel space between digits */
|
/* 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)
|
if(i == 0)
|
||||||
{
|
{
|
||||||
|
@ -857,8 +852,10 @@ void PlayerShoot()
|
||||||
shootDir.y = 0;
|
shootDir.y = 0;
|
||||||
|
|
||||||
player.shootCooldown = 1 / (float)player.shootPerSecond;
|
player.shootCooldown = 1 / (float)player.shootPerSecond;
|
||||||
|
|
||||||
bullets.bulletCount++;
|
bullets.bulletCount++;
|
||||||
bullets.bulletArray = (Bullet *) realloc(bullets.bulletArray, sizeof(Bullet) * bullets.bulletCount);
|
bullets.bulletArray = (Bullet *) realloc(bullets.bulletArray, sizeof(Bullet) * bullets.bulletCount);
|
||||||
|
|
||||||
newBullet = (bullets.bulletArray + bullets.bulletCount - 1);
|
newBullet = (bullets.bulletArray + bullets.bulletCount - 1);
|
||||||
newBullet -> position = player.position;
|
newBullet -> position = player.position;
|
||||||
newBullet -> position.x += offset;
|
newBullet -> position.x += offset;
|
||||||
|
@ -881,6 +878,7 @@ void EnemyShoot()
|
||||||
{
|
{
|
||||||
srand(time(0) + enemyRespawnCounter++);
|
srand(time(0) + enemyRespawnCounter++);
|
||||||
enemy = (enemies.enemyArray + i);
|
enemy = (enemies.enemyArray + i);
|
||||||
|
|
||||||
if(enemy -> fireCooldown > 0.0)
|
if(enemy -> fireCooldown > 0.0)
|
||||||
enemy -> fireCooldown -= deltaTime;
|
enemy -> fireCooldown -= deltaTime;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue