-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrial.cpp
More file actions
197 lines (181 loc) · 3.86 KB
/
Copy pathtrial.cpp
File metadata and controls
197 lines (181 loc) · 3.86 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
//Author: Amatya Katyayan
#include <simplecpp>
#include <iostream>
#include <string>
#include <queue>
#include <fstream>
#include <stdlib.h>
#include <vector>
#include <cassert>
using namespace std;
class planeShape : public Polygon{
public:
planeShape(){
double pts[14][2] = {{10, 0},
{0,3}, {-8,15}, {-5,3}, {-10,3},{-13,6},
{-13,-6},{-10,-3},{-5,-3},{-8,-15},{0,-3},{10,0}};
reset(canvas_width()/2,canvas_height()/2, pts, 13);
setScale(2.0);
setFill();
setColor(COLOR("blue"));
// penDown();
//Author: Amatya Katyayan
}
};
int main()
{
// cout<<"\n\n\n\n\n\n\n\n\n";
initCanvas("valid",900, 600);
Rectangle r(450,300,700,450);
planeShape t;
planeShape t2;
planeShape t3;
planeShape t4;
t2.setColor(COLOR("red"));
t3.setColor(COLOR("red"));
t4.setColor(COLOR("red"));
char command;
int flag=1, i=0, j=0, x=75, y= 100;
t3.forward(300);
t3.left(90);
t3.left(90);
t4.forward(300);
t4.left(90);
t4.left(90);
t3.right(90);
t3.forward(60);
t3.left(90);
t3.right(90);
t3.forward(60);
t3.left(90);
t4.left(90);
t4.forward(60);
t4.right(90);
t4.left(90);
t4.forward(60);
t4.right(90);
t.left(90);
t2.forward(300);
t.left(90);
t2.left(90);
t.forward(300);
t2.left(90);
t.right(90);
t.right(90);
Circle c1(800,300,10);
c1.setColor(COLOR("red"));
c1.setFill(true);
c1.left(90);
c1.left(90);
int u=1;
char cmd;
delay(2500);
cout<<"\n\t\t\t Rules of the game are: \n";
delay(1000);
cout<<"\n\t\t\t w-> up \n\t\t\t s-> down \n\t\t\t a-> left \n\t\t\t d-> right \n\t\t\t x-> exit \n";
delay(500);
cout<<"\n\n\n\n\t\t\t AVOID GETTING HIT by the Inccoming Plane\n\n";
delay(500);
cout<<"\n\n\t\t\t Are you Ready?? \t\t\t (Y/N) \n\n\t\t\t";
cin>>cmd;
delay(500);
cout<<"\n";
if(cmd=='y'||cmd=='Y')
{
//if(getClick()!=0) //Author: Amatya Katyayan
//{
cout<<"\n\n\n\n\t\t\t\t LOADING.... "<<'\n'<<'\t'<<'\t';
int g;
for(g=1;g<=20;g++)
{
delay(200);
cout<<"²²";
//x=x+2;
}
cout<<"\n\n\n LOADED !!";
cout<<"\n\n\n\n\n\n\n\n";
cout<<"\n\n Enter the command:";
for( j=0; j<10; j++)
{
while(i<100)
{
cin >> command;
delay(10);
//// t3.forward(75);
//t4.forward(75);
if(command == 'w')
{
flag=0;
t.left(90);
t.forward(60);
t.right(90);
flag=1;
t2.forward(75);
continue;
}
else if(command == 's')
{
t.right(90);
t.forward(60);
t.left(90);
t4.forward(75);
flag=0;
continue;
}
else if(command == 'd')
{
t.forward(70);
t3.forward(75);
flag=0;
}
else if(command == 'a')
{
t.left(90);
t.left(90);
t.forward(50);
t.right(90);
t.right(90);
flag=0;
}
else if(command=='x')
{
int graphicdriver=DETECT,graphicmode;
initgraph(&graphicdriver,&graphicmode,"c:\\turboc3\\bgi");
//Printing message for user
outtextxy(10, 10 + 10, "Hope you Enjoyed the Game !!");
//setting color to yellow
setcolor(YELLOW);
//creating circle and fill it with
//yellow color using floodfill.
circle(300, 100, 40);
setfillstyle(SOLID_FILL, YELLOW);
floodfill(300, 100, YELLOW);
//setting color to black
setcolor(BLACK);
setfillstyle(SOLID_FILL, BLACK);
//using fill ellipse and ellipse for creating face.
fillellipse(310, 85, 2, 6);
fillellipse(290, 85, 2, 6);
ellipse(300, 100, 205, 335, 20, 9);
ellipse(300, 100, 205, 335, 20, 10);
ellipse(300, 100, 205, 335, 20, 11);
getch();
exit(0);
}
flag=1;
i++;
}
}
}
else if(cmd==0)
{
exit(0);
}
else
{
cout<<"Wrong Choice!";
delay(100);
exit(0);
}
return 0;
}