-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTAIK.PAS
238 lines (214 loc) · 5.06 KB
/
TAIK.PAS
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
unit taik;
INTERFACE
uses graph;
Const sp = 8;
R = 20;
stX = 10;
stY = 10;
spD = 12;
spN = 9;
spTaik = 12;
type Ttaikiklis = object
private
xx, yy : integer;
public
procedure gaukXY (var x, y : integer);
procedure keiskXY (x, y : integer);
procedure piesk;
procedure valyk;
end;
Ttaikinys = object
private
SS : pointer;
xx, yy : integer;
public
constructor paruosk;
procedure gaukXY (var x, y : integer);
procedure keiskXY (x, y : integer);
procedure piesk;
procedure valyk;
function kelias (x : integer) : integer;
end;
Tstatus = object
private
sov, pat : byte;
public
constructor paruosk;
procedure piesk;
procedure pataikei;
procedure nepataikei;
function galima : boolean;
function laimejai : boolean;
end;
IMPLEMENTATION
procedure Ttaikiklis.gaukXY;
begin
x := xx;
y := yy;
end;
procedure Ttaikiklis.keiskXY;
begin
xx := x;
yy := y;
end;
procedure Ttaikiklis.piesk;
begin
setcolor (8);
line (xx - 10, yy - 2, xx - 2, yy - 2);
line (xx - 10, yy + 2, xx - 2, yy + 2);
line (xx + 2, yy - 2, xx + 10, yy - 2);
line (xx + 2, yy + 2, xx + 10, yy + 2);
line (xx + 2, yy - 10, xx + 2, yy - 2);
line (xx - 2, yy - 10, xx - 2, yy - 2);
line (xx + 2, yy + 2, xx + 2, yy + 10);
line (xx - 2, yy + 2, xx - 2, yy + 10);
end;
procedure Ttaikiklis.valyk;
begin
setcolor (0);
line (xx - 10, yy - 2, xx - 2, yy - 2);
line (xx - 10, yy + 2, xx - 2, yy + 2);
line (xx + 2, yy - 2, xx + 10, yy - 2);
line (xx + 2, yy + 2, xx + 10, yy + 2);
line (xx + 2, yy - 10, xx + 2, yy - 2);
line (xx - 2, yy - 10, xx - 2, yy - 2);
line (xx + 2, yy + 2, xx + 2, yy + 10);
line (xx - 2, yy + 2, xx - 2, yy + 10);
end;
constructor Ttaikinys.paruosk;
var ck : byte;
Mx, My : integer;
begin
cleardevice;
setcolor (0);
Mx := getmaxX div 2;
MY := getmaxY div 2;
setfillstyle (1, spTaik);
fillellipse (mx, my, R, R);
getmem (ss, ImageSize (mx - R, my - R, mx + R, my + R));
getimage (mx - R, my - R, mx + R, my + R, SS^);
cleardevice;
end;
procedure Ttaikinys.gaukXY;
begin
x := xx;
y := yy;
end;
procedure Ttaikinys.keiskXY;
begin
xx := x;
yy := y;
end;
procedure Ttaikinys.piesk;
begin
putimage (xx - R, yy - R, SS^, 0)
{setfillstyle (1, 1);
fillellipse (xx, yy, 20, 20);
}
end;
procedure Ttaikinys.valyk;
begin
setcolor (0);
setfillstyle (1, 0);
{ fillellipse (xx, yy, 75, 75)}
bar (xx - R, yy - R, xx + R, yy + R)
end;
function Ttaikinys.kelias;
var rad : real;
begin
rad := x / 35;
kelias := trunc ({75}130 * sin (rad)) + 150;
end;
constructor TSTATUS.paruosk;
begin
sov := 5;
pat := 0;
end;
procedure Tstatus.pataikei;
begin
inc (pat);
dec (sov);
end;
procedure Tstatus.nepataikei;
begin
dec (sov)
end;
function Tstatus.laimejai;
begin
if pat = 3 then laimejai := true
else laimejai := false;
end;
Function Tstatus.galima;
begin
if sov > 0 then galima := true
else galima := false
end;
procedure Tstatus.piesk;
procedure kulkaY (nr : byte);
var x, y : integer;
begin
y := stY + 7;
case nr of
1: x := stX + 20;
2: x := stX + 30;
3: x := stX + 40;
4: x := stX + 50;
5: x := stX + 60;
end;
setcolor (8);
setfillstyle (1, 8);
pieslice (x + 2, y, 0, 180, 2);
Bar (x, y, x + 4, y + 4);
setcolor (7);
setfillstyle (1, 7);
Bar (x, y + 5, x + 4, y + 22);
end;
procedure kulkaN (nr : byte);
var x, y : integer;
begin
y := stY + 5;
case nr of
1: x := stX + 20;
2: x := stX + 30;
3: x := stX + 40;
4: x := stX + 50;
5: x := stX + 60;
end;
setfillstyle (1, 0);
bar (x, y, x + 4, y + 24);
end;
procedure ratukas (nr : byte; dega : boolean);
var x, y, R : integer;
begin
R := 8;
Y := stY + 55;
case nr of
1: x := stX + 23;
2: x := stX + 43;
3: x := stX + 63;
end;
setcolor (7);
if dega then setfillstyle (1, spD)
else setfillstyle (1, spN);
FillEllipse (x, y, R, R);
end;
begin
setcolor (9);
rectangle (stX, stY, stX + 85 , stY + 84);
if sov > 0 then kulkaY (1) else kulkaN (1);
if sov > 1 then kulkaY (2) else kulkaN (2);
if sov > 2 then kulkaY (3) else kulkaN (3);
if sov > 3 then kulkaY (4) else kulkaN (4);
if sov > 4 then kulkaY (5) else kulkaN (5);
setcolor (7);
outtextxy (stx + 20, sty + 34, 'Kulkos');
if pat > 0 then ratukas (1, true)
else ratukas (1, false);
if pat > 1 then ratukas (2, true)
else ratukas (2, false);
if pat > 2 then ratukas (3, true)
else ratukas (3, false);
setcolor (7);
outtextXY (stx + 5, sty + 70, 'Pataikymai');
end;
end.