#define LEFT 75 //왼쪽 방향키
#define RIGHT 77 //오른쪽 방향키
#define UP 72 //위쪽 방향키
#define DOWN 80 //아래 방향키
#define PAUSE 112
#define ESC 27
//음악
#pragma comment(lib, "winmm.lib")
void draw_menu();//메뉴그리는 함수
void help(void); //도움말 화면 그리는 함수
void draw_game_screen(); //게임 실행 맵
void draw_game_score(); //게임 실행 하는데에 점수
void get_player_name(void);//플레이어 이름 입력 받기
int show_count(); //쇼카운트
int score; //점수
char userx = 0; //사용자
char usery = 0;
char player_name[30] = { 0, };//이름 넣기
void gameover(void); //게임 종료 화면
int x = 0, y = 0; //x, y 좌표 저장
gotoxy(62, 13);
printf("▶ ESC : 게임종료 ");
gotoxy(62, 15);
printf("▶ 걸린 시간 : %.2f");
gotoxy(60, 20);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK);
printf("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┛");
}
/*draw_game_score();*/
while (1) {
gotoxy(Monster.x, Monster.y); // x,y로 커서 이동
printf(".");
set_Monster_Position();
gotoxy(Monster.x, Monster.y); // x,y로 커서 이동
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_WHITE);
printf("#");
gotoxy(user.x, user.y); // x,y로 커서 이동
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_WHITE);
printf("&"); //그 자리에 '사용자' 출력
printf("\n");
Sleep(500);
솔직히 질문자의 내용이 잘 이해가 안갑니다.
조금더 상세히 알려주시고. 예시코드와 구현하고 싶은 기능에 대해서 적어주세요.
이런식은 답변하기가 어렵습니다 :(
사용자가 점을 먹으면 하나당 10씩 올라가게 만들고 싶어용 ㅠㅠ
#include
#include
#include
#include
#include
#include
#include
#define COLOR_YELLOW 6
#define COLOR_BBLUE 11
#define COLOR_WHITE 15
#define COLOR_PINK 13
#define LEFT 75 //왼쪽 방향키
#define RIGHT 77 //오른쪽 방향키
#define UP 72 //위쪽 방향키
#define DOWN 80 //아래 방향키
#define PAUSE 112
#define ESC 27
//음악
#pragma comment(lib, "winmm.lib")
void draw_menu();//메뉴그리는 함수
void help(void); //도움말 화면 그리는 함수
void draw_game_screen(); //게임 실행 맵
void draw_game_score(); //게임 실행 하는데에 점수
void get_player_name(void);//플레이어 이름 입력 받기
int show_count(); //쇼카운트
int score; //점수
char userx = 0; //사용자
char usery = 0;
char player_name[30] = { 0, };//이름 넣기
void gameover(void); //게임 종료 화면
int x = 0, y = 0; //x, y 좌표 저장
int map[29][45] =
{
{ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,0,1,0,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,1 },
{ 1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1 },
{ 1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1 },
{ 1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,1,1,1,1,1,1,1,0,0,0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,1,1,1,1,1,1,1,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,1,1,1,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1 },
{ 1,1,1,1,1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,1,1,1,1,1 },
{ 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1 },
{ 1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,1 },
{ 1,0,0,1,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,1,1,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1 },
{ 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
{ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }
};
typedef struct PLAY
{
int x, y;
}PLAY;
PLAY Monster;//몬스터
typedef struct PLAYS
{
int x, y;
}PLAYS;
PLAYS user;//사용자
void init_Monster_Position() {
Monster.x = 1;
Monster.y = 1;
}
void set_Monster_Position() {
int rand1 = 0, rand2 = 0;
int temp_x = 0, temp_y = 0;
srand((unsigned int)time(NULL));
rand1 = rand() % 2;
rand2 = rand() % 2;
temp_x = Monster.x + rand1;
temp_y = Monster.y + rand2;
if (map[temp_y][temp_x] != 1 && map[temp_y][temp_x] != 3) {
map[temp_y][temp_x] = 2;// 몬스터
Monster.x = temp_x;
Monster.y = temp_y;
}
}
void RemoveCursor(void) //커서 지우기
{
CONSOLE_CURSOR_INFO curInfo;
GetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &curInfo);
curInfo.bVisible = 0; // bVisible 멤버 변경
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &curInfo); // 변경값 적용
}
void gotoxy(int x, int y) {
COORD CursorPosition = { x,y };
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), CursorPosition);
}
int main(void) {
int num = 0;
while (1) {
//게임 메인화면 설정하기
init_Monster_Position();
RemoveCursor();
draw_menu();
get_player_name();
show_count();
PlaySound(TEXT("CAMP.wav"), NULL, SND_ASYNC | SND_LOOP);
draw_game_screen();
/*draw_game_score();*/
}
}
void draw_menu() {
system("cls");
gotoxy(7, 2);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_YELLOW);
printf("□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□");
gotoxy(15, 5); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK); printf(" ■■■■ ■ ■■■■■ ■ ■ ■ ■ ■");
gotoxy(15, 6); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK); printf(" ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■");
gotoxy(15, 7); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK); printf(" ■■■■ ■ ■ ■ ■■■ ■ ■ ■ ■ ■ ■ ■ ■ ■");
gotoxy(15, 8); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK); printf(" ■ ■■■■■ ■ ■ ■ ■ ■■■■■ ■ ■ ■");
gotoxy(15, 9); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK); printf(" ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■");
gotoxy(15, 10); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK); printf(" ■ ■ ■ ■■■■■ ■ ■ ■ ■ ■ ■");
for (int i = 0; i < 30; i++) {
gotoxy(7, 3 + i); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_YELLOW);
printf("□");
gotoxy(115, 3 + i); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_YELLOW);
printf("□");
}
gotoxy(50, 18); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_WHITE);
printf("< 번호를 입력해 주세요 >");
gotoxy(55, 20);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_BBLUE);
printf("1.게임 시작");
gotoxy(55, 22); printf("2.게임 방법");
gotoxy(55, 24); printf("3.게임 종료 ");
gotoxy(7, 33);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_YELLOW);
printf("□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□");
gotoxy(100, 35); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_WHITE);
printf("1705058 이예진");
gotoxy(100, 36); printf("1705081 배지은");
while (1) {
unsigned char num = 2;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 11);
num = _getch();
if (num == '1') {
break;
}
else if (num == '2') {
help();
}
else if (num == '3') {
exit(0);
}
else if (num == 27) {
draw_menu();
}
else {
gotoxy(45, 27);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_WHITE);
printf("숫자 1~3중에 선택해서 입력해주세요.");
}
}
}
void draw_game_screen()
{
system("cls");
char ch;
PLAY user = { 20,15 };
score = 0; //점수 초기화
{
for (int i = 0; i < sizeof(map) / sizeof(map[0]); i++)
{
for (int j = 0; j < sizeof(map[0]) / sizeof(map[0][0]); j++)
{
ch = map[i][j];
switch (ch)
{
case 0:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_YELLOW);
printf(" ");
break;
case 1:
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_YELLOW);
printf("*");
break;
}
}
printf("\n");
}
gotoxy(60, 2);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK);
printf("┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┓");
gotoxy(73, 4);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_WHITE);
printf("Lv.1");
gotoxy(62, 7);
printf("▶ Name : %s", player_name);
gotoxy(62, 9);
printf("▶ Score : %d점", score);
gotoxy(62, 11);
printf("▶ Highest Score : %d점", score);
gotoxy(62, 13);
printf("▶ ESC : 게임종료 ");
gotoxy(62, 15);
printf("▶ 걸린 시간 : %.2f");
gotoxy(60, 20);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK);
printf("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┛");
}
/*draw_game_score();*/
while (1) {
gotoxy(Monster.x, Monster.y); // x,y로 커서 이동
printf(".");
set_Monster_Position();
gotoxy(Monster.x, Monster.y); // x,y로 커서 이동
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_WHITE);
printf("#");
gotoxy(user.x, user.y); // x,y로 커서 이동
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_WHITE);
printf("&"); //그 자리에 '사용자' 출력
printf("\n");
Sleep(500);
//if (map[user.y][user.x] == 2) {
// score += 10;
// gotoxy(62, 9);
// printf("▶ Score : %d점", score);
// gotoxy(62, 11);
// printf("▶ Highest Score : %d점", score);
//
//}
if (map[user.y][user.x] == 2) {
gameover();
break;
}
if (kbhit()) //kbhit() =>키보드의 입력을 감지하는 함수
{
gotoxy(user.x, user.y);//이전의 좌표로가서
printf(" ");//이전의 위치를 지워라
switch (getch())
{
case LEFT:
if (map[user.x - 1] > 0)
{
user.x--;
}
break;
case RIGHT:
if (map[user.x + 1] > 0)
{
user.x++;
}
break;
case UP:
if (map[user.y - 1] > 0)
{
user.y--;
}
break;
case DOWN:
if (map[user.y + 1] > 0)
{
user.y++;
}
break;
case ESC:
exit(0);
}
}
}
}
//
//void draw_game_score()
//{
// score_count();
// gotoxy(60, 2);
// SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK);
// printf("┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┓");
// gotoxy(73, 4);
// SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_WHITE);
// printf("Lv.1");
// gotoxy(62, 7);
// printf("▶ Name : %s", player_name);
// gotoxy(62, 9);
// printf("▶ Score : %d점", score);
// gotoxy(62, 11);
// printf("▶ Highest Score : %d점");
// gotoxy(62, 13);
// printf("▶ ESC : 게임종료 ");
// gotoxy(62, 15);
// printf("▶ 걸린 시간 : %.2f");
// gotoxy(60, 20);
// SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK);
// printf("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┛");
//
//
//}
void get_player_name(void) {
system("cls");
//사용자의 정보 저장
gotoxy(33, 12);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_YELLOW);
printf("┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓");
for (int i = 0; i < 10; i++) {
gotoxy(33, 13 + i); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_YELLOW);
printf("┃");
gotoxy(84, 13 + i); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_YELLOW);
printf("┃");
}
gotoxy(33, 22);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_YELLOW);
printf("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛");
gotoxy(38, 15); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_WHITE);
printf("▶ 게임 할 때 사용할 이름을 입력해주세요 ◀");
gotoxy(53, 19);
printf("입력 : ");
scanf("%s", player_name);
}
void help(void) { //도움말(2번키 눌렸을 때 보일 화면)
system("cls");
gotoxy(19, 2);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK);
printf("┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓");
for (int i = 0; i < 30; i++) {
gotoxy(19, 3 + i); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK);
printf("┃");
gotoxy(103, 3 + i); SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK);
printf("┃");
}
gotoxy(29, 5);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_YELLOW);
printf("▷ 조작키 ◁");
gotoxy(29, 7);
printf("▶ 이동 : ← ↑ ↓ →");
gotoxy(29, 12);
printf("▷ 규칙 ◁");
gotoxy(29, 14);
printf("① 방향키를 이용해 몬스터들을 피해다닙니다.");
gotoxy(29, 16);
printf("② 피해다니면서 점들을 먹으면 점수가 올라가게 됩니다.");
gotoxy(29, 18);
printf("③ 레벨(난이도)는 점수 30, 50, 80, 100을 달성하면 자동으로 올라갑니다.");
gotoxy(29, 20);
printf("④ 몬스터들에게 닿이면 게임이 종료됩니다.");
gotoxy(29, 25);
printf("▷ 개발자 ◁");
gotoxy(29, 27);
printf("이예진, 배지은");
gotoxy(29, 30);
printf("ESC : 그만보기");
gotoxy(19, 33);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_PINK);
printf("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛");
}
int show_count()
{
system("cls");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), COLOR_WHITE);
gotoxy(35, 13);
printf(" ■■■ ");
gotoxy(35, 14);
printf(" ■ ■ ");
gotoxy(35, 15);
printf(" ■ ");
gotoxy(35, 16);
printf(" ■ ");
gotoxy(35, 17);
printf(" ■■ ");
gotoxy(35, 18);
printf(" ■ ");
gotoxy(35, 19);
printf(" ■ ■ ");
gotoxy(35, 20);
printf(" ■ ■ ");
gotoxy(35, 21);
printf(" ■■■ ");
Sleep(500); //1초간 sleep
gotoxy(35, 13);
printf(" ■■■ ");
gotoxy(35, 14);
printf(" ■ ■ ");
gotoxy(35, 15);
printf(" ■ ");
gotoxy(35, 16);
printf(" ■ ");
gotoxy(35, 17);
printf(" ■ ");
gotoxy(35, 18);
printf(" ■ ");
gotoxy(35, 19);
printf(" ■ ");
gotoxy(35, 20);
printf(" ■ ");
gotoxy(35, 21);
printf(" ■■■■■■ ");
Sleep(500); //1초간 sleep
gotoxy(35, 13);
printf(" ■ ");
gotoxy(35, 14);
printf(" ■■ ");
gotoxy(35, 15);
printf(" ■ ");
gotoxy(35, 16);
printf(" ■ ");
gotoxy(35, 17);
printf(" ■ ");
gotoxy(35, 18);
printf(" ■ ");
gotoxy(35, 19);
printf(" ■ ");
gotoxy(35, 20);
printf(" ■ ");
gotoxy(35, 21);
printf(" ■■■ ");
Sleep(500); //1초간 sleep
gotoxy(35, 13);
printf(" ■■■ ");
gotoxy(35, 14);
printf(" ■ ■ ");
gotoxy(35, 15);
printf(" ■ ■ ");
gotoxy(35, 16);
printf(" ■ ■■ ");
gotoxy(35, 17);
printf(" ■ ■ ■ ");
gotoxy(35, 18);
printf(" ■■ ■ ");
gotoxy(35, 19);
printf(" ■ ■ ");
gotoxy(35, 20);
printf(" ■ ■ ");
gotoxy(35, 21);
printf(" ■■■ ");
Sleep(500); //1초간 sleep
}
//int score_count(void) //점수를 카운트하는 함수
//{
// int score = 0;
// score += 10;
// return score;
//}
void gameover(void) {
system("cls");
gotoxy(23, 3);
printf(" ▒▒▒▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒▒▒▒▒▒");
gotoxy(23, 4);
printf("▒ ▒ ▒▒▒ ▒▒▒ ▒▒▒ ▒");
gotoxy(23, 5);
printf("▒ ▒ ▒ ▒▒▒ ▒▒▒ ▒");
gotoxy(23, 6);
printf("▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒");
gotoxy(23, 7);
printf("▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒");
gotoxy(23, 8);
printf("▒ ▒▒▒▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒▒▒▒▒▒▒▒");
gotoxy(23, 9);
printf("▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒");
gotoxy(23, 10);
printf("▒ ▒ ▒▒▒▒▒▒▒ ▒ ▒ ▒ ▒");
gotoxy(23, 11);
printf("▒ ▒ ▒ ▒ ▒ ▒ ▒");
gotoxy(23, 12);
printf("▒ ▒ ▒ ▒ ▒ ▒ ▒");
gotoxy(23, 13);
printf(" ▒▒▒▒▒▒▒ ▒ ▒ ▒ ▒ ▒▒▒▒▒▒▒▒");
gotoxy(23, 16);
printf(" ▒▒▒▒▒▒▒ ▒ ▒ ▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒");
gotoxy(23, 17);
printf("▒ ▒ ▒ ▒ ▒ ▒ ▒");
gotoxy(23, 18);
printf("▒ ▒ ▒ ▒ ▒ ▒ ▒");
gotoxy(23, 19);
printf("▒ ▒ ▒ ▒ ▒ ▒ ▒");
gotoxy(23, 20);
printf("▒ ▒ ▒ ▒ ▒ ▒ ▒ ");
gotoxy(23, 21);
printf("▒ ▒ ▒ ▒ ▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ");
gotoxy(23, 22);
printf("▒ ▒ ▒ ▒ ▒ ▒ ▒");
gotoxy(23, 23);
printf("▒ ▒ ▒ ▒ ▒ ▒ ▒ ");
gotoxy(23, 24);
printf("▒ ▒ ▒▒▒ ▒ ▒ ▒");
gotoxy(23, 25);
printf("▒ ▒ ▒▒▒ ▒ ▒ ▒");
gotoxy(23, 26);
printf(" ▒▒▒▒▒▒▒ ▒▒▒ ▒▒▒▒▒▒▒▒▒ ▒ ▒");
gotoxy(35, 28);
printf("────────────────────────────────────────────────────");
gotoxy(55, 30);
printf("이름 : %s", player_name);
gotoxy(55, 33);
printf("점수 : %d", score);
gotoxy(35, 35);
printf("────────────────────────────────────────────────────");
Sleep(7000);
main();
}
아 그리고 스톱워치두용...! 게임 화면 나타나는 때 부터 0.00초 이렇게 나타내고 싶어용 ㅠㅠ
댓글 달기