Repository navigation
Expand file tree
/
Copy pathgameend.cpp
More file actions
120 lines (118 loc) · 2.77 KB
/
Copy pathgameend.cpp
File metadata and controls
120 lines (118 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#define _CRT_SECURE_NO_WARNINGS
#pragma once
#define X 498
#define Y 810
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <graphics.h>
#include<conio.h>
#include<windows.h>
extern int GameEnd;//1是胜利,-1是失败
extern int score; //分数
extern int Bktype;
extern int Buttontype;
extern IMAGE background;
extern void play(int Bktype, int Buttontype, IMAGE background);
char test[100];
char ch;
int Restart();
int end() {
setbkmode(TRANSPARENT);
//sprintf_s(test, "GameEnd:%d", GameEnd);
//outtextxy(100, 600, test);
//跳出一个结算界面
if (GameEnd==-1)
{
setlinecolor(BLACK);
setfillcolor(YELLOW);
rectangle(80, 130, 400, 520);
floodfill(85, 135,BLACK);
// 设置字体
settextcolor(BLACK);
settextstyle(25, 0, "Consolas");
// 输出文字
char scoreText[40];
sprintf_s(scoreText, "你的分数是:%d", score);
outtextxy(100, 150, _T("游戏结束"));
outtextxy(100, 200, scoreText);
if (score >= 0 && score <= 500)
{
outtextxy(100, 250, _T("就这也想合成中山大学?"));
}
else if (score > 500 && score <= 1000)
{
outtextxy(100, 250, _T("或许刚刚少手抖一下就成功了"));
outtextxy(100, 300, _T("继续加油!"));
}
else if (score > 1000 && score <= 2000)
{
outtextxy(100, 250, _T("你已经渐入佳境了,继续努力!"));
}
else if (score > 2000 && score <= 4000)
{
outtextxy(100, 250, _T("你离合成中山大学就差一点点了"));
outtextxy(100, 300, _T("再尝试一下吧!"));
}
else if (score > 4000)
{
outtextxy(100, 250, _T("你的分数已经很高了,你是最棒的!"));
}
// 设置字体
settextstyle(15, 0, _T("宋体"));
// 输出文字
outtextxy(200, 500, _T("按空格键退出"));
// 等待按键
while (1)
{
ch = _getch();
if (ch == ' ')
break;
else if (ch == 'R' || ch == 'r')
Restart();
}
// 关闭图形窗口
closegraph();
}
else if (GameEnd == 1)
{
setlinecolor(BLACK);
setfillcolor(YELLOW);
rectangle(80, 130, 400, 520);
floodfill(85, 135, BLACK);
// 设置字体
settextcolor(BLACK);
settextstyle(25, 0, "Consolas");
// 输出文字
char scoreText[20];
sprintf_s(scoreText, "你的分数是:%d", score);
outtextxy(100, 150, _T("恭喜你合成出了中山大学!"));
outtextxy(100, 200, scoreText);
// 设置字体
settextstyle(15, 0, _T("宋体"));
// 输出文字
outtextxy(200, 500, _T("按空格键退出"));
// 等待按键
while (1)
{
ch = _getch();
if (ch == ' ')
break;
else if (ch == 'R' || ch == 'r')
{
Restart();
break;
}
}
// 关闭图形窗口
closegraph();
}
return 0;
}
int Restart() {
printf("Sorry, Restart function is not available now.\n");
//play(Bktype,Buttontype,background);
//Game();
return 0;
}