-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorld Build 2.0.pas
193 lines (158 loc) · 4.08 KB
/
World Build 2.0.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
Program world_build_test;
var path,turn: integer;
key: char;
devmod,rgbplayer: boolean;
objectcount,tpcount,collidecheck,teleportcheck,xres,yres,x,y:integer;
objectsave: array [1..100,1..5] of integer;
teleportpos: array [1..100,1..5] of integer;
objecttexture: array [1..100] of char;
mundo: integer;
procedure worldbuild;
var xcursor,ycursor,xcursorres,ycursorres,color: integer;
outworld,paste,del,textureselect,colorselect: boolean;
i,n,j: integer;
texture: char;
Begin
//Atribuicoes
cursoroff;
outworld := false;
xcursor := 10;
ycursor := 10;
xcursorres := 2;
ycursorres := 2;
objectcount := 1;
while(outworld = false) do
Begin
colorselect := false;
textureselect := false;
paste := false;
del := false;
key := readkey;
gotoxy(xcursor,ycursor);
for i := 1 to xcursorres do
for n := 1 to ycursorres do
begin
gotoxy(xcursor+i,ycursor+n);
write(' ');
end;
case(key)of
'w': ycursor := ycursor - 1;
's': ycursor := ycursor + 1;
'a': xcursor := xcursor - 1;
'd': xcursor := xcursor + 1;
'i': ycursorres := ycursorres - 1;
'k': ycursorres := ycursorres + 1;
'j': xcursorres := xcursorres - 1;
'l': xcursorres := xcursorres + 1;
#13: paste := true;
#8: del := true;
#27: outworld := true;
't': textureselect := true;
'c': colorselect := true;
end;
if(textureselect = true) then
begin
gotoxy(4,2);
textcolor(cyan);
write(' Textura: ');
textcolor(green);
read(texture);
end;
if(colorselect = true) then
begin
gotoxy(4,4);
textcolor(cyan);
write(' Cor: ');
textcolor(green);
read(color);
end;
if (xcursorres = 0) then
xcursorres := 1;
if (ycursorres = 0) then
ycursorres := 1;
if (paste = true) then
begin
objectcount := objectcount + 1;
end;
if( del = true) then
begin
objectcount := objectcount - 1;
for j := 1 to objectcount do
begin
gotoxy(objectsave[j,1],objectsave[j,2]);
for i := 1 to objectsave[j,3] do
for n := 1 to objectsave[j,4] do
begin
gotoxy(objectsave[j,1]+i,objectsave[j,2]+n);
write(' ');
end;
end;
end;
objectsave[objectcount,1] := xcursor;
objectsave[objectcount,2] := ycursor;
objectsave[objectcount,3] := xcursorres;
objectsave[objectcount,4] := ycursorres;
objectsave[objectcount,5] := color;
objecttexture[objectcount] := texture;
for j := 1 to objectcount do
begin
gotoxy(objectsave[j,1],objectsave[j,2]);
for i := 1 to objectsave[j,3] do
for n := 1 to objectsave[j,4] do
begin
textcolor(objectsave[j,5]);
gotoxy(objectsave[j,1]+i,objectsave[j,2]+n);
write(objecttexture[j]);
end;
end;
End;
End;
procedure worldstore;
var j: integer;
Begin
for j := 1 to objectcount do
Begin
gotoxy(4,j+2);
write(objectsave[j,1]);
gotoxy(8,j+2);
write(objectsave[j,2]);
gotoxy(12,j+2);
write(objectsave[j,3]);
gotoxy(16,j+2);
write(objectsave[j,4]);
gotoxy(20,j+2);
write(objectsave[j,5]);
gotoxy(24,j+2);
write(objecttexture[j]);
End;
End;
//Frame Print Procedure
procedure object(x,y,xres,yres,color: integer; texture:char);
var i,n: integer;
Begin
//Print
for i := 1 to xres do
begin
for n := 1 to yres do
begin
textcolor(color);
gotoxy(x+i-1,y+n-1);
write(texture);
end;
end;
End;
Begin
//Frame
object(2, 7, 4, 42, 8, #219);
object(4, 7, 203, 1, 8, #219);
object(207, 7, 4, 42, 8, #219);
object(4, 48, 203, 1, 8, #219);
//Frame End
textcolor(yellow);
gotoxy(1,1);
write(' Comandos: "wasd" para mover os objetos, "ijkl" para mudar as dimens�es, "enter" para colar, "backspace" para apagar, "t" para mudar a textura, "c" para mudar a cor do objeto.');
textcolor(green);
worldbuild;
clrscr;
worldstore;
End.