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

Commit

Permalink
53X Again 5!
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Jun 24, 2020
1 parent 0bd209b commit 99ed4db
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Snake
<p>Snake v1.2</p>
<p>Snake v1.3</p>
<p>Visual Studio 2019</p>
<p>.NET Framework 4.8 (Minimum 4.0)</p>
<img src="https://www.photo.herominyum.com/resimler/2020/06/24/dJm1.png" />
Expand Down
44 changes: 23 additions & 21 deletions Snake/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ namespace Snake
{
public partial class Game : Form
{
int VWidth, Width2, VHeight, Height2, X, Y, EX, EY, FX, FX2, FY, FY2;
int VWidth, Width2, VHeight, Height2, X, Y, AX, AY, FX, FX2, FY, FY2;
Direction Direct;
int[] Locations1 = new int[9999999];
int[] Locations2 = new int[9999999];
int[] Locations1 = new int[999999];
int[] Locations2 = new int[999999];
int Queue, Queue2/*, Queue3*/, T1, T2 = 0;

int Measurement = 5;
Expand Down Expand Up @@ -49,7 +49,7 @@ private enum Direction
Up, Down, Left, Right
}

private void Drawing(int EX, int EY)
private void Drawing(int AX, int AY)
{
Pen Pencil = new Pen(Color.Black, 5);
Graphics Graph = null;
Expand All @@ -59,8 +59,8 @@ private void Drawing(int EX, int EY)
{
Graph.DrawRectangle(Pencil, new Rectangle(Locations1[Queue2], Locations2[Queue2], 10, 10));
Graph.FillRectangle(Colored, Locations1[Queue2], Locations2[Queue2], 10, 10);
if (EX == Locations1[Queue2] && EY == Locations2[Queue2])
AppleEat(EX, EY);
if (AX == Locations1[Queue2] && AY == Locations2[Queue2])
AppleEat(AX, AY);
Queue2++;
}
Pencil.Dispose();
Expand All @@ -72,16 +72,16 @@ private void Drawing(int EX, int EY)
Queue2 = Queue;
}

private void AppleEat(int EX, int EY)
private void AppleEat(int AX, int AY)
{
Apple = false;
Measurement += Growth;
Pen Pencil = new Pen(Color.White, 5);
Graphics Graph = null;
Graph = CreateGraphics();
SolidBrush Colored = new SolidBrush(Color.White);
Graph.DrawRectangle(Pencil, new Rectangle(EX, EY, 10, 10));
Graph.FillRectangle(Colored, EX, EY, 10, 10);
Graph.DrawRectangle(Pencil, new Rectangle(AX, AY, 10, 10));
Graph.FillRectangle(Colored, AX, AY, 10, 10);
Pencil.Dispose();
Graph.Dispose();
Colored.Dispose();
Expand Down Expand Up @@ -134,14 +134,14 @@ private void Gaming_Tick(object sender, EventArgs e)
if (Apple == false)
{
Apple = true;
EX = Rastgele.Next(50, VWidth - 50);
EY = Rastgele.Next(50, VHeight - 50);
AX = Rastgele.Next(50, VWidth - 50);
AY = Rastgele.Next(50, VHeight - 50);
Pen Pencil = new Pen(Color.Red, 5);
Graphics Graph = null;
Graph = CreateGraphics();
SolidBrush Colored = new SolidBrush(Color.Red);
Graph.DrawRectangle(Pencil, new Rectangle(EX, EY, 10, 10));
Graph.FillRectangle(Colored, EX, EY, 10, 10);
Graph.DrawRectangle(Pencil, new Rectangle(AX, AY, 10, 10));
Graph.FillRectangle(Colored, AX, AY, 10, 10);
Pencil.Dispose();
Graph.Dispose();
Colored.Dispose();
Expand All @@ -152,8 +152,8 @@ private void Gaming_Tick(object sender, EventArgs e)
Graphics Graph = null;
Graph = CreateGraphics();
SolidBrush Colored = new SolidBrush(Color.Red);
Graph.DrawRectangle(Pencil, new Rectangle(EX, EY, 10, 10));
Graph.FillRectangle(Colored, EX, EY, 10, 10);
Graph.DrawRectangle(Pencil, new Rectangle(AX, AY, 10, 10));
Graph.FillRectangle(Colored, AX, AY, 10, 10);
Pencil.Dispose();
Graph.Dispose();
}
Expand All @@ -174,14 +174,14 @@ private void Gaming_Tick(object sender, EventArgs e)
Locations1[Queue2] = 99999;
Locations2[Queue2] = 99999;
}
if (Width2 == EX && Height2 == EY)
AppleEat(EX, EY);
if (Width2 == AX && Height2 == AY)
AppleEat(AX, AY);
else
{
FX = Width2 - EX;
FY = Height2 - EY;
FX = Width2 - AX;
FY = Height2 - AY;
if ((Math.Abs(FX) >= 0 && Math.Abs(FX) <= 8) && (Math.Abs(FY) >= 0 && Math.Abs(FY) <= 8))
AppleEat(EX, EY);
AppleEat(AX, AY);
}
T2 += 50;
if (T2 >= 1000)
Expand Down Expand Up @@ -233,7 +233,9 @@ private void Game_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
e.IsInputKey = true;
string Key = e.KeyCode.ToString();
if (Continue)
if (Key == "Escape" || Key == "escape")
Application.Exit();
else if (Continue)
{
if (Key == "Right" || Key == "right")
{
Expand Down
6 changes: 3 additions & 3 deletions Snake/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Snake")]
[assembly: AssemblyDescription("Snake v1.2")]
[assembly: AssemblyDescription("Snake v1.3")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Taiizor")]
[assembly: AssemblyProduct("Snake")]
Expand All @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
Binary file modified Snake/bin/Release/Snake.exe
Binary file not shown.
Binary file modified Snake/bin/Release/Snake.pdb
Binary file not shown.

0 comments on commit 99ed4db

Please sign in to comment.