Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.

Commit 99ed4db

Browse files
committed
53X Again 5!
1 parent 0bd209b commit 99ed4db

File tree

5 files changed

+27
-25
lines changed

5 files changed

+27
-25
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Snake
2-
<p>Snake v1.2</p>
2+
<p>Snake v1.3</p>
33
<p>Visual Studio 2019</p>
44
<p>.NET Framework 4.8 (Minimum 4.0)</p>
55
<img src="https://www.photo.herominyum.com/resimler/2020/06/24/dJm1.png" />

Snake/Game.cs

+23-21
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ namespace Snake
77
{
88
public partial class Game : Form
99
{
10-
int VWidth, Width2, VHeight, Height2, X, Y, EX, EY, FX, FX2, FY, FY2;
10+
int VWidth, Width2, VHeight, Height2, X, Y, AX, AY, FX, FX2, FY, FY2;
1111
Direction Direct;
12-
int[] Locations1 = new int[9999999];
13-
int[] Locations2 = new int[9999999];
12+
int[] Locations1 = new int[999999];
13+
int[] Locations2 = new int[999999];
1414
int Queue, Queue2/*, Queue3*/, T1, T2 = 0;
1515

1616
int Measurement = 5;
@@ -49,7 +49,7 @@ private enum Direction
4949
Up, Down, Left, Right
5050
}
5151

52-
private void Drawing(int EX, int EY)
52+
private void Drawing(int AX, int AY)
5353
{
5454
Pen Pencil = new Pen(Color.Black, 5);
5555
Graphics Graph = null;
@@ -59,8 +59,8 @@ private void Drawing(int EX, int EY)
5959
{
6060
Graph.DrawRectangle(Pencil, new Rectangle(Locations1[Queue2], Locations2[Queue2], 10, 10));
6161
Graph.FillRectangle(Colored, Locations1[Queue2], Locations2[Queue2], 10, 10);
62-
if (EX == Locations1[Queue2] && EY == Locations2[Queue2])
63-
AppleEat(EX, EY);
62+
if (AX == Locations1[Queue2] && AY == Locations2[Queue2])
63+
AppleEat(AX, AY);
6464
Queue2++;
6565
}
6666
Pencil.Dispose();
@@ -72,16 +72,16 @@ private void Drawing(int EX, int EY)
7272
Queue2 = Queue;
7373
}
7474

75-
private void AppleEat(int EX, int EY)
75+
private void AppleEat(int AX, int AY)
7676
{
7777
Apple = false;
7878
Measurement += Growth;
7979
Pen Pencil = new Pen(Color.White, 5);
8080
Graphics Graph = null;
8181
Graph = CreateGraphics();
8282
SolidBrush Colored = new SolidBrush(Color.White);
83-
Graph.DrawRectangle(Pencil, new Rectangle(EX, EY, 10, 10));
84-
Graph.FillRectangle(Colored, EX, EY, 10, 10);
83+
Graph.DrawRectangle(Pencil, new Rectangle(AX, AY, 10, 10));
84+
Graph.FillRectangle(Colored, AX, AY, 10, 10);
8585
Pencil.Dispose();
8686
Graph.Dispose();
8787
Colored.Dispose();
@@ -134,14 +134,14 @@ private void Gaming_Tick(object sender, EventArgs e)
134134
if (Apple == false)
135135
{
136136
Apple = true;
137-
EX = Rastgele.Next(50, VWidth - 50);
138-
EY = Rastgele.Next(50, VHeight - 50);
137+
AX = Rastgele.Next(50, VWidth - 50);
138+
AY = Rastgele.Next(50, VHeight - 50);
139139
Pen Pencil = new Pen(Color.Red, 5);
140140
Graphics Graph = null;
141141
Graph = CreateGraphics();
142142
SolidBrush Colored = new SolidBrush(Color.Red);
143-
Graph.DrawRectangle(Pencil, new Rectangle(EX, EY, 10, 10));
144-
Graph.FillRectangle(Colored, EX, EY, 10, 10);
143+
Graph.DrawRectangle(Pencil, new Rectangle(AX, AY, 10, 10));
144+
Graph.FillRectangle(Colored, AX, AY, 10, 10);
145145
Pencil.Dispose();
146146
Graph.Dispose();
147147
Colored.Dispose();
@@ -152,8 +152,8 @@ private void Gaming_Tick(object sender, EventArgs e)
152152
Graphics Graph = null;
153153
Graph = CreateGraphics();
154154
SolidBrush Colored = new SolidBrush(Color.Red);
155-
Graph.DrawRectangle(Pencil, new Rectangle(EX, EY, 10, 10));
156-
Graph.FillRectangle(Colored, EX, EY, 10, 10);
155+
Graph.DrawRectangle(Pencil, new Rectangle(AX, AY, 10, 10));
156+
Graph.FillRectangle(Colored, AX, AY, 10, 10);
157157
Pencil.Dispose();
158158
Graph.Dispose();
159159
}
@@ -174,14 +174,14 @@ private void Gaming_Tick(object sender, EventArgs e)
174174
Locations1[Queue2] = 99999;
175175
Locations2[Queue2] = 99999;
176176
}
177-
if (Width2 == EX && Height2 == EY)
178-
AppleEat(EX, EY);
177+
if (Width2 == AX && Height2 == AY)
178+
AppleEat(AX, AY);
179179
else
180180
{
181-
FX = Width2 - EX;
182-
FY = Height2 - EY;
181+
FX = Width2 - AX;
182+
FY = Height2 - AY;
183183
if ((Math.Abs(FX) >= 0 && Math.Abs(FX) <= 8) && (Math.Abs(FY) >= 0 && Math.Abs(FY) <= 8))
184-
AppleEat(EX, EY);
184+
AppleEat(AX, AY);
185185
}
186186
T2 += 50;
187187
if (T2 >= 1000)
@@ -233,7 +233,9 @@ private void Game_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
233233
{
234234
e.IsInputKey = true;
235235
string Key = e.KeyCode.ToString();
236-
if (Continue)
236+
if (Key == "Escape" || Key == "escape")
237+
Application.Exit();
238+
else if (Continue)
237239
{
238240
if (Key == "Right" || Key == "right")
239241
{

Snake/Properties/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// set of attributes. Change these attribute values to modify the information
66
// associated with an assembly.
77
[assembly: AssemblyTitle("Snake")]
8-
[assembly: AssemblyDescription("Snake v1.2")]
8+
[assembly: AssemblyDescription("Snake v1.3")]
99
[assembly: AssemblyConfiguration("")]
1010
[assembly: AssemblyCompany("Taiizor")]
1111
[assembly: AssemblyProduct("Snake")]
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.2.0.0")]
35-
[assembly: AssemblyFileVersion("1.2.0.0")]
34+
[assembly: AssemblyVersion("1.3.0.0")]
35+
[assembly: AssemblyFileVersion("1.3.0.0")]

Snake/bin/Release/Snake.exe

0 Bytes
Binary file not shown.

Snake/bin/Release/Snake.pdb

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)