2016년 2월 16일 화요일

4.1 Time Function Addtion



  • 'showTime()' Function
---------------------------------------------------------------------------------
void showTime(void)
{
int newTime = time(NULL);
int diff = newTime - curTime;
point curPos;

if (sec < diff)
{
curPos = GetCurrentCursorPos();
sec = diff;

if (sec == 30 && !timeBlocking)
{
gameLevelUp();
timeBlocking = 1;
}
else if (sec == 60 && !timeBlocking)
{
curTime = time(NULL);
min++;
sec = 0;
gameLevelUp();
timeBlocking = 1;
}
else if(sec==31 || sec == 0)
timeBlocking = 0;

SetCurrentCursorPos(32, 10);
printf("   %02d : %02d    ", min, sec);

SetCurrentCursorPos(curPos.x, curPos.y);
}
}
---------------------------------------------------------------------------------

  •  add 'time.h' header file
        - Express time between 00:00 to 99:59 as using time(NULL)
  •  Whenever Time is flowing, Game Progress quicken once every 30s
         - It is controlled by 'timeBlocking' valuable whether 'gameLevelUp()' is called or not


Source Download (Github Repository)

댓글 없음:

댓글 쓰기