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

Commit

Permalink
53X Again 12!
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Jul 19, 2020
1 parent 32a435d commit d3b57da
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 9 deletions.
21 changes: 19 additions & 2 deletions Snake/Game.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 43 additions & 7 deletions Snake/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public partial class Game : Form
Direction Direct;
int[] Locations1 = new int[999999];
int[] Locations2 = new int[999999];
int Queue, Queue2/*, Queue3*/, T1, T2 = 0;
int Queue, Queue2/*, Queue3*/, T1, T2, Measurement2 = 0;

int Measurement = 5;
int Measurement = 555;
int Growth = 5;
bool Apple = false;
bool Continue = true;
Expand All @@ -31,6 +31,12 @@ public Game()
}

private void Game_Load(object sender, EventArgs e)
{
Measurement2 = Measurement;
Game_Start();
}

private void Game_Start()
{
VWidth = SystemInformation.PrimaryMonitorSize.Width;
VHeight = SystemInformation.PrimaryMonitorSize.Height;
Expand All @@ -44,6 +50,29 @@ private void Game_Load(object sender, EventArgs e)
SnakeHead.Location = new Point(Width2, Height2);
}

private void Game_Restart()
{
Pen Pencil = new Pen(Color.White, 9999);
Graphics Graph = null;
Graph = CreateGraphics();
SolidBrush Colored = new SolidBrush(Color.White);
Graph.DrawRectangle(Pencil, new Rectangle(VWidth / 2, VHeight / 2, 9999, 9999));
Graph.FillRectangle(Colored, VWidth / 2, VHeight / 2, 9999, 9999);
Pencil.Dispose();
Graph.Dispose();
Colored.Dispose();
Game_Start();
Measurement = Measurement2;
Queue = 0;
Queue2 = 0;
T1 = 0;
T2 = 0;
Array.Clear(Locations1, 0, 999999);
Array.Clear(Locations2, 0, 999999);
Gaming.Enabled = true;
Continue = true;
}

private enum Direction
{
Up, Down, Left, Right
Expand Down Expand Up @@ -172,8 +201,8 @@ private void Gaming_Tick(object sender, EventArgs e)
Colored.Dispose();
/*Array.Clear(Locations1, 0, Queue2 + 1);
Array.Clear(Locations2, 0, Queue2 + 1);*/
Locations1[Queue2] = 99999;
Locations2[Queue2] = 99999;
Locations1[Queue2] = 999999;
Locations2[Queue2] = 999999;
}

if (Width2 == AX && Height2 == AY)
Expand All @@ -182,7 +211,7 @@ private void Gaming_Tick(object sender, EventArgs e)
{
FX = Width2 - AX;
FY = Height2 - AY;
if ((Math.Abs(FX) >= 0 && Math.Abs(FX) <= 8) && (Math.Abs(FY) >= 0 && Math.Abs(FY) <= 8))
if (Math.Abs(FX) >= 0 && Math.Abs(FX) <= 8 && Math.Abs(FY) >= 0 && Math.Abs(FY) <= 8)
AppleEat(AX, AY);
}

Expand Down Expand Up @@ -241,6 +270,8 @@ private void Death_Tick(object sender, EventArgs e)
{
if (Continue)
{
PauseLabel.Visible = false;

Parallel.For(0, Queue, i =>
{
FX2 = Locations1[i] - Width2;
Expand All @@ -249,7 +280,7 @@ private void Death_Tick(object sender, EventArgs e)
{
Gaming.Enabled = false;
Continue = false;
Application.Restart();
Game_Restart();
}
});

Expand All @@ -263,12 +294,17 @@ private void Death_Tick(object sender, EventArgs e)
{
Gaming.Enabled = false;
Continue = false;
Application.Restart();
Game_Restart();
}
Queue3++;
}
*/
}
else
{
PauseLabel.Visible = true;
PauseLabel.BringToFront();
}
}
}
}
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 d3b57da

Please sign in to comment.