Всем привет) Я юный программист (мне 14) Вот пишу игру в косноле на C# что то ти по песочниц НЕ ЧЕРЕЗ МАСИВЫ. В игре можно только строить символами ну и передвегат курсор, и присутствует система загрузки карт(Через txt файлы). Вопрос в том как сделать анимацию или физики в игре к примеру ставишь символ 0 и тип песок падает в низ что то ти по такого БЕЗ МАСИВОВ. Пж помогите юному программисту)) Вот код игры
C# |
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
| using System;
using System.IO; //Для работы с сохранением в фалйы
namespace ConsoleGameACSII_OBT
{
class Program
{
static void Main(string[] args)
{
Char skin;
string name;
int lvl = 1;
int many = 100;
string resim;
int x = 15;
int y = 15;
Console.Title = "GameASCII";
Console.BufferWidth = 6000;
Console.BufferHeight = 6000;
string skint = System.IO.File.ReadAllText(@"C:\ConsoleGameInfo\skin.txt");
string namet = File.ReadAllText(@"C:\ConsoleGameInfo\name.txt");
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.WriteLine(" =======================================================================================");
Console.WriteLine(" Здраствуйте " + namet + " ");
Console.WriteLine(" =======================================================================================");
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.WriteLine(" =======================================================================================");
Console.WriteLine(" ");
Console.WriteLine(" Продолжить Начать ");
Console.WriteLine(" ");
Console.WriteLine(" =======================================================================================");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.WriteLine(" ");
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine(" * * * * ");
Console.WriteLine(" * * * * ");
Console.WriteLine("* * * * ");
Console.WriteLine(" * * * * ");
Console.WriteLine(" * * * * * ");
Console.WriteLine(" * ");
Console.WriteLine(" * * * ");
Console.WriteLine(" * * ");
Console.WriteLine(" * * * ");
Console.WriteLine(" * * * * ");
Console.WriteLine(" * * * * * ");
Console.WriteLine(" * * ");
Console.WriteLine(" * * * * ");
Console.WriteLine(" * * * ");
Console.WriteLine(" * * * * * ");
Console.SetCursorPosition(6, 14);
resim = Convert.ToString(Console.ReadLine());
Console.Clear();
if (resim == "Продолжить")
{
string lvlt = File.ReadAllText(@"C:\ConsoleGameInfo\lvl.txt");
string manyt = File.ReadAllText(@"C:\ConsoleGameInfo\many.txt");
Console.WriteLine(namet);
Console.WriteLine(manyt);
Console.WriteLine(lvlt);
}
else
{
Console.Clear();
Console.WriteLine("============================================");
Console.WriteLine(" Ваше имя ");
Console.WriteLine("============================================");
name = Convert.ToString(Console.ReadLine());
Console.Clear();
StreamWriter n = new StreamWriter(@"C:\ConsoleGameInfo\name.txt");
n.WriteLine(name);
n.Close();
Console.WriteLine("============================================");
Console.WriteLine(" Символ за который будете играть ");
Console.WriteLine("============================================");
skin = Convert.ToChar(Console.ReadLine());
StreamWriter f = new StreamWriter(@"C:\ConsoleGameInfo\skin.txt");
f.WriteLine(skin);
f.Close();
}
Console.Clear();
Console.WriteLine("============================================");
Console.WriteLine(" Хотите загрузить карту? ");
Console.WriteLine(" Да Нет ");
Console.WriteLine("============================================");
string yes_not = Convert.ToString(Console.ReadLine());
Console.Clear();
if(yes_not == "Да")
{
Console.WriteLine("============================================");
Console.WriteLine(" Укажите полный путь с фалу картой ");
Console.WriteLine("============================================");
string carta = Convert.ToString(Console.ReadLine());
Console.Clear();
string cartmapa = File.ReadAllText(carta);
Console.WriteLine(cartmapa);
}
ConsoleKeyInfo k;
do
{
Console.SetCursorPosition(x, y);
Console.Write("$");
k = Console.ReadKey(true);
if (k.Key == ConsoleKey.UpArrow)
{
Console.SetCursorPosition(x, y);
Console.Write(" ");
y--;
}
else if (k.Key == ConsoleKey.DownArrow)
{
Console.SetCursorPosition(x, y);
Console.Write(" ");
y++;
}
else if (k.Key == ConsoleKey.RightArrow)
{
Console.SetCursorPosition(x, y);
Console.Write(" ");
x++;
}
else if (k.Key == ConsoleKey.LeftArrow)
{
Console.SetCursorPosition(x, y);
Console.Write(" ");
x--;
}
else if (k.Key == ConsoleKey.D)
{
col_yellow();
Console.WriteLine("0");
}
else if (k.Key == ConsoleKey.S)
{
reding();
}
else if (k.Key == ConsoleKey.A)
{
col_red();
Console.WriteLine("♥");
}
else if (k.Key == ConsoleKey.W)
{
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("~");
}
if (x < 0)
{
x = 0;
}
else if (x >= Console.BufferWidth)
{
x = Console.BufferWidth - 1;
}
if (y < 0)
{
y = 0;
}
else if (y >= Console.BufferHeight)
{
y = Console.BufferHeight - 1;
}
} while (k.Key != ConsoleKey.Escape);
Console.ReadLine();
}
/*=============================
ФУНКЦИИ ДЛЯ ЦВЕТОВ
=============================*/
public static void reding()
{
col_green();
Console.WriteLine('#');
}
public static void col_red()
{
Console.ForegroundColor = ConsoleColor.DarkRed;
}
public static void col_green()
{
Console.ForegroundColor = ConsoleColor.Green;
}
public static void col_yellow()
{
Console.ForegroundColor = ConsoleColor.DarkYellow;
}
public static void col_Brown()
{
Console.ForegroundColor = ConsoleColor.Magenta;
}
public static void col_darkgreen()
{
Console.ForegroundColor = ConsoleColor.DarkGreen;
}
public static void col_gray()
{
Console.ForegroundColor = ConsoleColor.Gray;
}
public static void col_seml()
{
Console.ForegroundColor = ConsoleColor.Cyan;
}
}
} |
|