/*
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <conio.h>
#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77
int x = 43;
int y = 0; //플레이어의 위치
int a =44;
int b=0;
int f=0,score=0;
char c;
void gotoxy(int y, int x);
void info();
void player()
{
f=0;
gotoxy(0,0);
printf("score : %d",score);
if (_kbhit()) {
c = _getch();
f=f+1;
gotoxy(20,5);
printf(" ");
gotoxy(19,5);
printf(" ");
gotoxy(18,5);
printf(" ");
gotoxy(20-5, 5);
printf("^");
gotoxy(19-5, 5);
printf("T");
gotoxy(18-5, 5);
printf("O");
f=f+1;
Sleep(500);
gotoxy(15,5);
printf(" ");
gotoxy(14,5);
printf(" ");
gotoxy(13,5);
printf(" ");
gotoxy(15+5, 5);
printf("^");
gotoxy(14+5, 5);
printf("T");
gotoxy(13+5, 5);
printf("O");
}
}
int main()
{
gotoxy(20, 0);
printf("--------------------------------------------");
gotoxy(20, 5);
printf("^");
gotoxy(19, 5);
printf("T");
gotoxy(18, 5);
printf("O");
for(;;)
{
gotoxy(20,x--);
printf("M");
Sleep(10);
gotoxy(20,a--);
printf("-");
Sleep(10);
if(x==0)
{
x=x+59;
}
if(f==0&&x==4)
{
gotoxy(15,40);
printf("*(((||FAIL||)))*");
Sleep(1000);
gotoxy(15,40);
printf(" ");
score=0;
}
else
{
score=score+1;
}
}
}
void gotoxy(int y, int x) {
COORD Pos;
Pos.X = x; Pos.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos);
}
void info() {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
gotoxy(10, 50);
printf("색상을 변경할려면\n");
gotoxy(11, 50);
printf("하양->1,파랑->2,초록->3,하늘->4");
gotoxy(12, 50);
printf("빨강->5,보라->6,노랑->7을입력하세요.");
gotoxy(13, 50);
printf("t를 누르면 모두 지워집니다.");
}*/
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <conio.h>
#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77
int x = 43;
int y = 0; //플레이어의 위치
int a =44;
int b=0;
int g=0;
void gotoxy(int y, int x);
void info();
int main()
{
int f=0,score=0,life=3,jumps=0;
//int i;
char c;
info();
gotoxy(20, 0);
printf("--------------------------------------------");
gotoxy(20, 5);
printf("^");
gotoxy(19, 5);
printf("T");
gotoxy(18, 5);
printf("O");
for (;;)
{
f=0;
gotoxy(1,0);
printf("LIFE : %d",life);
gotoxy(0,0);
printf("SCORE : %d",score);
gotoxy(2,0);
printf("NUMBER OF JUMPS : %d",g);
if (_kbhit()) {
c = _getch();
f=f+1;
g=g+1;
gotoxy(20,5);
printf(" ");
gotoxy(19,5);
printf(" ");
gotoxy(18,5);
printf(" ");
gotoxy(20-5, 5);
printf("^");
gotoxy(19-5, 5);
printf("T");
gotoxy(18-5, 5);
printf("O");
f=f+1;
Sleep(500);
gotoxy(15,5);
printf(" ");
gotoxy(14,5);
printf(" ");
gotoxy(13,5);
printf(" ");
gotoxy(15+5, 5);
printf("^");
gotoxy(14+5, 5);
printf("T");
gotoxy(13+5, 5);
printf("O");
}
gotoxy(20,x--);
printf("M");
Sleep(10);
gotoxy(20,a--);
printf("-");
Sleep(10);
if(x==0)
{
x=x+59;
}
if(f==0&&x==4)
{
life=life-1;
gotoxy(16,20);
printf("CRASH!!(충돌!!)");
Sleep(1000);
gotoxy(16,20);
printf(" ");
g=0;
}
else if(g>5)
{
life=life-1;
gotoxy(16,20);
printf("exceeded the number of jumps!!(점프 횟수를 넘었어!!)");
Sleep(1000);
gotoxy(16,20);
printf(" ");
g=0;
}
else if(x==2&&g!=0)
{
gotoxy(16,20);
g=0;
score=score+101;
}
else if(life<=0)
{
gotoxy(15,20);
printf("*(((||FAIL||)))*");
Sleep(4000);
gotoxy(15,20);
printf(" ");
score=0;
life=3;
}
else
{
score=score+1;
}
}
}
void gotoxy(int y, int x) {
COORD Pos;
Pos.X = x; Pos.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos);
}
void info() {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
gotoxy(10, 20);
printf("**game rule**(게임 규칙)\n");
gotoxy(11, 20);
printf("Jump by pressing any key(아무키나 누르면 점프가 됩니다)\n");
gotoxy(12, 20);
printf("5 jump chances(다섯번의 점프 기회가 있습니다)\n");
gotoxy(13, 20);
printf("Avoid obstacle M within 5 times.(다섯번의 기회로 M을 피하세요.)\n");
}