전에도 테트리스 때문에 몇번 질문하러 왔었고 현재 거의다 완성 되었는데 버그때문에 짜증나네요 ㅠㅠ
블럭이 내려가는거랑 키입력받는게 같이 묶여있어서 좌우로 움직이고 블럭 돌리는것도 딜레이 영향을 받아서 쓰레드로 해결을 했는데요
문제는 플레이 하다보면 이상한 잔상같은게 남아요 (이상한곳에 네모가 그려짐)
물론 블럭으로는 인식이 안돼서 플레이에는 지장이 없는데 너무 거슬려요.. 꽤 자주 일어나는 현상이라서..
어떻게 고쳐야 할까요
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<time.h>
#include<windows.h>
#include<memory.h>
#include <mmsystem.h>
#include<process.h>
#pragma comment(lib, "winmm.lib")
#define col GetStdHandle(STD_OUTPUT_HANDLE)
#define blg SetConsoleTextAttribute(col,0x0003); //청녹
#define yel SetConsoleTextAttribute(col,0x000e); //노랑
#define red SetConsoleTextAttribute(col,0x000c); //피색
#define gre SetConsoleTextAttribute(col,0x000a); //연두
#define sky SetConsoleTextAttribute(col,0x000b); //하늘
#define pur SetConsoleTextAttribute(col,0x000d);//자주
#define blue SetConsoleTextAttribute(col,0x0009); //파란색
//#define korobushka ".\\korobushka.wav"
//도형의 모양 저장
char form[7][4][8] =
{
{ { 1,0,1,1,1,2,1,3 },{ 0,1,1,1,2,1,3,1 },{ 1,0,1,1,1,2,1,3 },{ 0,1,1,1,2,1,3,1 } },
{ { 1,1,2,1,1,2,2,2 },{ 1,1,2,1,1,2,2,2 },{ 1,1,2,1,1,2,2,2 },{ 1,1,2,1,1,2,2,2 } },
{ { 2,1,0,2,1,2,1,1 },{ 1,0,1,1,2,1,2,2 },{ 2,1,0,2,1,2,1,1 },{ 1,0,1,1,2,1,2,2 } },
{ { 0,1,1,1,1,2,2,2 },{ 2,0,2,1,1,1,1,2 },{ 0,1,1,1,1,2,2,2 },{ 2,0,2,1,1,1,1,2 } },
{ { 1,0,1,1,1,2,2,2 },{ 0,1,1,1,2,1,0,2 },{ 1,0,2,0,2,1,2,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_a = 0, sign_b = 0; int crush = 0;
int c;
int called = 1;
int timsign = 0;
//점수 저장
int num = 0;
int timingspeed = 300;
//블록의 종류를 나타내는 변수
int form_kind;
int form_kind_next;
int hold_kind; int form_kind_cpy; int hold_kind_cpy;
int temp_kind;
//블록의 회전 형태를 나타내는 변수
int rotate_kind;
//화면 상에서의 좌표
int screen_x, screen_y;
void CursorOff()
{
CONSOLE_CURSOR_INFO Information;
Information.dwSize = 1;
Information.bVisible = FALSE;
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &Information);
}
void CurrentXY(int x, int y)
{
COORD Location;
Location.X = x;
Location.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Location);
}
void Initial()
{
int i, j;
for (i = 0; i<21; i++)
{
CurrentXY(30, i);
printf("▣");
CurrentXY(52, i);
printf("▣");
}
for (j = 0; j<12; j++)
{
CurrentXY((30) + j * 2, 20);
printf("▣");
}
CurrentXY(30, 20);
printf("▣");
CurrentXY(52, 20);
printf("▣");
for (i = 0; i<21; i++)
{
for (j = 0; j<12; j++)
{
if (i == 20 || j == 0 || j == 11)
tetris[i][j] = 3;
else
tetris[i][j] = 0;
}
}
}
int Check_board(int x, int y)
{
int i, temp = 0;
for (i = 0; i<4; i++)
{
//현재 위치에 있는 테트리스 도형 정보 읽어옴
temp = tetris[y + form[form_kind][rotate_kind][i * 2 + 1]][x + form[form_kind][rotate_kind][i * 2]];
if (temp > 1) {
return TRUE;
}
}
return FALSE;
}
void PrintForm()
{
int i;
for (i = 0; i<4; i++)
{
CurrentXY(30 + (screen_x + form[form_kind][rotate_kind][i * 2]) * 2, screen_y + form[form_kind][rotate_kind][i * 2 + 1]);
if (form_kind == 0)
gre
if (form_kind == 1)
yel
if (form_kind == 2)
blg
if (form_kind == 3)
blue
if (form_kind == 4)
red
if (form_kind == 5)
sky
if (form_kind == 6)
pur
printf("■");
tetris[screen_y + form[form_kind][rotate_kind][i * 2 + 1]][screen_x + form[form_kind][rotate_kind][i * 2]] = 1;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x007);
}
}
void PrintNext()
{
int i;
for (i = 0; i<4; i++)
{
CurrentXY(61 + form[form_kind][0][i * 2] * 2, 2 + form[form_kind][0][i * 2 + 1]);
printf(" ");
}
for (i = 0; i<4; i++)
{
CurrentXY(61 + form[form_kind_next][0][i * 2] * 2, 2 + form[form_kind_next][0][i * 2 + 1]);
if (form_kind_next == 0)
gre
if (form_kind_next == 1)
yel
if (form_kind_next == 2)
blg
if (form_kind_next == 3)
blue
if (form_kind_next == 4)
red
if (form_kind_next == 5)
sky
if (form_kind_next == 6)
pur
printf("■");
tetris[screen_y + form[form_kind][rotate_kind][i * 2 + 1]][screen_x + form[form_kind][rotate_kind][i * 2]] = 1;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x007);
}
}
void DeleteForm()
{
for (int i = 0; i<4; i++)
{
CurrentXY(30 + (screen_x + form[form_kind][rotate_kind][i * 2]) * 2, screen_y + form[form_kind][rotate_kind][i * 2 + 1]);//삭제 위치 지정
printf(" ");//도형 삭제
tetris[screen_y + form[form_kind][rotate_kind][i * 2 + 1]][screen_x + form[form_kind][rotate_kind][i * 2]] = 0;//비어있는 상황인 1을 tetris 배열에 저장
}
}
void DeleteForm_hold()
{
for (int i = 0; i<4; i++)
{
CurrentXY(61 + form_cpy[hold_kind][0][i * 2] * 2, 16 + form_cpy[hold_kind][0][i * 2 + 1]);//삭제 위치 지정
printf(" ");//도형 삭제
}
}
void DeleteForm_next()
{
for (int i = 0; i<4; i++)
{
CurrentXY(61 + form_cpy[form_kind_next][0][i * 2] * 2, 2 + form_cpy[form_kind_next][0][i * 2 + 1]);//삭제 위치 지정
printf(" ");//도형 삭제
}
}
void Reprint_hold()
{
for (int i = 0; i<4; i++)
{
CurrentXY(61 + form[hold_kind][0][i * 2] * 2, 16 + form[hold_kind][0][i * 2 + 1]);//삭제 위치 지정
if (hold_kind == 0)
gre
if (hold_kind == 1)
yel
if (hold_kind == 2)
blg
if (hold_kind == 3)
blue
if (hold_kind == 4)
red
if (hold_kind == 5)
sky
if (hold_kind == 6)
pur
printf("■");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x007);
}
}
void Reprint_next()
{
for (int i = 0; i<4; i++)
{
CurrentXY(61 + form[form_kind_next][0][i * 2] * 2, 2 + form[form_kind_next][0][i * 2 + 1]);//삭제 위치 지정
if (form_kind_next == 0)
gre
if (form_kind_next == 1)
yel
if (form_kind_next == 2)
blg
if (form_kind_next == 3)
blue
if (form_kind_next == 4)
red
if (form_kind_next == 5)
sky
if (form_kind_next == 6)
pur
printf("■");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x007);
}
}
void Timing()
{
int chk;
chk = Check_board(screen_x, screen_y + 1);
if (chk == TRUE) {
if (hold_sign == 2) {
hold_sign = 1;
}
first_hold = 2;
Sleep(400);
}
if (10 <= num&&timsign == 0)
{
timingspeed = 290;
CurrentXY(9, 1);
printf("CLEARED");
timsign = 1;
}
if (17 <= num&&timsign == 1)
{
timingspeed = 270;
CurrentXY(9, 3);
printf("CLEARED");
timsign = 2;
}
if (sign == 0) {
if (28 <= num&&timsign == 2)
{
timingspeed = 220;
memset(form, 0, 224 * sizeof(char));
memcpy((char*)form, (char*)formb, 224 * sizeof(char));
DeleteForm_next();
DeleteForm_hold();
CurrentXY(9, 5);
printf("CLEARED");
sign_a = 1;
sign = 1;
timsign = 3;
}
}
if (40 <= num&&timsign == 3)
{
timingspeed = 210;
CurrentXY(9, 7);
printf("CLEARED ");
timsign = 4;
}
if (70 <= num&&timsign == 4)
{
timingspeed = 190;
CurrentXY(9, 9);
printf("CLEARED");
timsign = 5;
}
if (si_gn == 0) {
if (100 <= num&&timsign == 5)
{
timingspeed = 150;
CurrentXY(9, 11);
printf("CLEARED");
memset(form, 0, 224 * sizeof(char));
memcpy((char*)form, (char*)formc, 224 * sizeof(char));
DeleteForm_next();
DeleteForm_hold();
sign_b = 1;
si_gn = 1;
timsign = 6;
}
}
if (sign_a == 1 || sign_b == 1) {
CurrentXY(35, 0);
printf(" ");
CurrentXY(35, 3);
printf(" ");
CurrentXY(35, 4);
printf(" ");
CurrentXY(35, 1);
printf("블록이 변형되며");
CurrentXY(34, 2);
printf("속도가 대폭 상승");
Sleep(2000);
CurrentXY(35, 1);
printf(" ");
CurrentXY(34, 2);
printf(" ");
if (first_hold == 2 || first_hold == 1) {
Reprint_hold();
}
Reprint_next();
sign_a = 0;
sign_b = 0;
}
if (135 <= num&&timsign == 6)
{
timingspeed = 130;
CurrentXY(9, 13);
printf("CLEARED");
timsign = 7;
}
if (180 <= num&&timsign == 7)
{
timingspeed = 120;
CurrentXY(13, 15);
printf("CLEARED");
CurrentXY(1, 17);
printf("축하합니다");
timsign = 8;
}
DWORD thisTickCount;
static DWORD lastTickCount = 0;
DWORD delay = timingspeed;
thisTickCount = GetTickCount();
while (1)
{
if ((thisTickCount - lastTickCount)>delay)
{
lastTickCount = thisTickCount;
return;
}
thisTickCount = GetTickCount();
}
}
void Write_board()
{
int i;
for (i = 0; i<4; i++)
{
tetris[screen_y + form[form_kind][rotate_kind][i * 2 + 1]][screen_x + form[form_kind][rotate_kind][i * 2]] = 2;
}
}
int Check_line2(int row)
{
int chk = 0;
int j;
for (j = 1; j<11; j++)
chk += tetris[row][j];
if (chk == 20) return TRUE;
else return FALSE;
}
void Move_data(int row)
{
int i, j;
for (i = row - 1; i >= 0; i--)
for (j = 1; j<11; j++)
tetris[i + 1][j] = tetris[i][j];
}
void Print_data()
{
int i, j;
for (i = 0; i<20; i++)
for (j = 1; j<11; j++)
if (tetris[i][j] == 2)
{
CurrentXY(30 + j * 2, i);
printf("■");
}
else
{
CurrentXY(30 + j * 2, i);
printf(" ");
}
CurrentXY(10, 22);
printf("점수 : %d", num);
}
void Check_line()
{
int rst, i; int count = 0;
int temp = 0;
for (i = screen_y; i < screen_y + 4; i++)
{
rst = Check_line2(i);
if (rst == TRUE)
{
num += 3 + (3 * temp);
temp++;
Move_data(i);
Print_data();
i--;
if (temp == 2) {
CurrentXY(39, 23);
printf("2 COMBO");
}
if (temp == 3) {
CurrentXY(39, 23);
printf("3 COMBO");
}
if (temp == 4) {
CurrentXY(39, 23);
printf("4 COMBO");
}
}
}
if (temp == 0) {
CurrentXY(39, 23);
printf(" ");
}
}
int Go_Down()
{
int chk2; int a;
a = timingspeed;
chk2 = Check_board(screen_x, screen_y + 1);
if (chk2 == TRUE)
{
//
Write_board();
Check_line();
return TRUE;
}
else {
DeleteForm();
screen_y++;
PrintForm();
return FALSE;
}
}
void aaa() {
srand((unsigned)time(NULL));
form_kind_next = rand() % 7;
}
int Select()
{
int chk1, chk2; int prev_rotate, new_rotate; int rtn_value;
if (GetAsyncKeyState(VK_SPACE))
{
while (!Go_Down());
if (hold_sign == 2) {
hold_sign = 1;
}
if (first_hold == 1) {
first_hold = 2;
}
return FALSE;
}
if (GetAsyncKeyState(VK_ESCAPE))
{
exit(0);
}
if (GetAsyncKeyState(VK_SPACE) && GetAsyncKeyState(VK_LCONTROL)) {
exit(0);
}
if (GetAsyncKeyState(VK_LCONTROL) && hold_sign == 0)
{
hold_sign = 1;
first_hold = 1;
hold_kind = form_kind;
for (int i = 0; i<4; i++)
{
CurrentXY(61 + form[hold_kind][0][i * 2] * 2, 16 + form[hold_kind][0][i * 2 + 1]);
if (hold_kind == 0)
gre
if (hold_kind == 1)
yel
if (hold_kind == 2)
blg
if (hold_kind == 3)
blue
if (hold_kind == 4)
red
if (hold_kind == 5)
sky
if (hold_kind == 6)
pur
printf("■");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x007);
}
DeleteForm();
form_kind = form_kind_next;
return FALSE;
}
if (GetAsyncKeyState(VK_LCONTROL) && hold_sign == 1 && first_hold == 2)
{
int j; int k;
for (j = 0; j<4; j++)
{
CurrentXY(61 + form[hold_kind][0][j * 2] * 2, 16 + form[hold_kind][0][j * 2 + 1]);//삭제 위치 지정
printf(" ");//도형 삭제
}
temp_kind = hold_kind;
hold_kind = form_kind;
DeleteForm();
for (k = 0; k<4; k++) {
CurrentXY(61 + form[hold_kind][0][k * 2] * 2, 16 + form[hold_kind][0][k * 2 + 1]);
if (hold_kind == 0)
gre
if (hold_kind == 1)
yel
if (hold_kind == 2)
blg
if (hold_kind == 3)
blue
if (hold_kind == 4)
red
if (hold_kind == 5)
sky
if (hold_kind == 6)
pur
printf("■");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 0x007);
}
form_kind = temp_kind;
return FALSE;
}
rtn_value = Go_Down();
if (rtn_value == TRUE)
{
return FALSE;
}
else
{
return TRUE;
}
return rtn_value;
}
unsigned _stdcall Thread(void *arg)
{
while (1)
{
int chk1, chk2; int prev_rotate, new_rotate; int rtn_value;
Sleep(150);
if (GetAsyncKeyState(VK_LEFT))
{
chk1 = Check_board(screen_x - 1, screen_y);
if (chk1 == FALSE)
{
DeleteForm();
screen_x--;
PrintForm();
}
}
if (GetAsyncKeyState(VK_RIGHT))
{
chk1 = Check_board(screen_x + 1, screen_y);
if (chk1 == FALSE)
{
DeleteForm();
screen_x++;
PrintForm();
}
}
if (GetAsyncKeyState(VK_UP))
{
prev_rotate = rotate_kind;
if (rotate_kind == 3)
rotate_kind = 0;
else
rotate_kind++;
new_rotate = rotate_kind;
chk1 = Check_board(screen_x, screen_y);
if (chk1 == TRUE)
{
rotate_kind = prev_rotate;
}
else {
rotate_kind = prev_rotate;
DeleteForm();
rotate_kind = new_rotate;
PrintForm();
}
}
if (GetAsyncKeyState(VK_DOWN))
{
chk1 = Check_board(screen_x, screen_y + 1);
if (chk1 == FALSE)
{
DeleteForm();
screen_y += 1;
PrintForm();
}
}
if (sign_a == 1 || sign_b == 1) {
Sleep(2000);
}
}
}
int retry()
{
int a, i;
c = num;
//PlaySound(NULL, 0, 0);
memset(form, 0, 224 * sizeof(char));
memcpy((char*)form, (char*)form_cpy, 224 * sizeof(char));
for (i = 8; i < 14; ++i)
{
CurrentXY(20, 7); printf("┏━━━━━━━━━━━━━━━━━━━━━┓");
CurrentXY(20, i); printf("┃"); CurrentXY(64, i); printf("┃");
CurrentXY(20, 14); printf("┗━━━━━━━━━━━━━━━━━━━━━┛");
CurrentXY(34, 10); printf("최종 점수 : %d", c);
CurrentXY(34, 12); printf("다시하시겠습니까?", c);
CurrentXY(33, 13); printf("예 : 11 아니요 : 22", c);
}
a = _getch();
//num = 0;
if (a == '2')
{
return 0;
}
else if (a != '1')
{
retry();
}
}
int tytnis()
{
int chk, chk3;
system("cls");
system("mode con lines=25 cols=77");
CurrentXY(60, 1);
printf(" 다음 도형 ");
CurrentXY(60, 15);
printf(" 홀드 슬롯 ");
CurrentXY(54, 6);
printf("▣▣▣▣▣▣▣▣▣▣▣");
CurrentXY(54, 0);
printf("▣▣▣▣▣▣▣▣▣▣▣");
CurrentXY(54, 14);
printf("▣▣▣▣▣▣▣▣▣▣▣");
CurrentXY(54, 20);
printf("▣▣▣▣▣▣▣▣▣▣▣");
CurrentXY(1, 1);
printf("stage 1");
CurrentXY(1, 3);
printf("stage 2");
CurrentXY(1, 5);
printf("stage 3");
CurrentXY(1, 7);
printf("stage 4");
CurrentXY(1, 9);
printf("stage 5");
CurrentXY(1, 11);
printf("stage 6");
CurrentXY(1, 13);
printf("stage 7");
CurrentXY(1, 15);
printf("stage FINAL");
CurrentXY(10, 22);
printf("점수 : 0");
Initial();
CursorOff();
CurrentXY(8, 20);
printf("이전 점수 : %d", c);
//PlaySound(TEXT(korobushka), NULL, SND_FILENAME | SND_ASYNC | SND_LOOP);
aaa();
_beginthreadex(NULL, 0, Thread, 0, 0, NULL);
do {
screen_x = 4;
screen_y = 0;
chk = Check_board(screen_x, screen_y);
chk3 = Check_board(screen_x, screen_y + 1);
if (GetAsyncKeyState(VK_LCONTROL) && hold_sign == 1 && first_hold == 2) {
hold_sign = 2;
}
else if (GetAsyncKeyState(VK_LCONTROL) && hold_sign == 0) {
hold_sign = 1;
}
else {
form_kind = form_kind_next;
form_kind_next = rand() % 7;
rotate_kind = 0;
PrintForm();
PrintNext();
}
if (hold_sign == 1 && first_hold == 2 || hold_sign == 0) {
CurrentXY(74, 19);
printf(" ON");
}
else {
CurrentXY(74, 19);
printf("OFF");
}
//0=그릴 수 없다1=그릴 수 있다
if (chk == TRUE&&chk3 == TRUE) {
break;
}
else if (chk == FALSE&&chk3 == TRUE)
{
Write_board();
Check_line();
break;
}
//while (1) { Sleep(50); key(); }
do {
Timing();
} while (Select());
} while (1);
{
system("cls");
retry();
if (retry() == '1')
{
num = 0;
first_hold = 0;
hold_sign = 0;
timingspeed = 300;
tytnis();
}
return 0;
}
}
int help()
{
int i, a;
system("cls");
for (i = 8; i < 18; ++i)
{
CurrentXY(26, 7); printf("┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓");
CurrentXY(26, i); printf("┃"); CurrentXY(86, i); printf("┃");
CurrentXY(26, 18); printf("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛");
CurrentXY(43, 16); printf("1 : 게임 시작 2 : 종료");
//CurrentXY(36, 16); printf("*홀드는 하드 드랍 이후 활성화 (첫 홀드 제외)");
CurrentXY(42, 9); printf("↑ : 도형 돌리기");
CurrentXY(42, 10); printf("→ : 도형 오른쪽으로 가기");
CurrentXY(42, 11); printf("← : 도형 왼쪽으로 가기");
CurrentXY(42, 12); printf("↓ : 도형 빨리 내리기");
CurrentXY(42, 13); printf("SB : 도형 한번에 내리기 (하드 드랍)");
CurrentXY(42, 14); printf("LCTRL : 홀드 (주의점 : 꾹 누를 것)");
}
a = _getch();
if (a == '1')
{
tytnis();
}
else if (a == '2')
{
exit(1);
}
else if (a != '1')
{
help();
}
}
//시작 화면
int main()
{
int i;
int a;
CursorOff();
system("mode con lines=27 cols=110");
for (i = 8; i < 18; ++i)
{
CurrentXY(26, 7); printf("┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓");
CurrentXY(26, i); printf("┃"); CurrentXY(86, i); printf("┃");
CurrentXY(26, 18); printf("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛");
CurrentXY(52, 10); printf("타이트니스");
CurrentXY(40, 14); printf("1 : 시작 2 : 도움말 3 : 종료");
CurrentXY(28, 17); printf("*게임 도중 esc누르면 종료됩니다.");
}
a = _getch();
if (a == '1')
{
tytnis();
}
else if (a == '3')
{
return 0;
}
else if (a == '2')
{
help();
}
else if (a != '1')
{
main();
}
}
댓글 0