Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Федеральное агентство образования РФ.docx
Скачиваний:
10
Добавлен:
07.03.2015
Размер:
65.06 Кб
Скачать

Руководство пользователя

↑ - Движение танка вверх

→ - Движение танка вправо

← - Движение танка влево

↓ - Движение танка вниз

Space – Выстрел

Escape – Выход в главное меню

Цель игры: выжить. Танк игрока рассчитан на 3 попадания вражеского снаряда. Танк противника способен выдержать только одно попадание. За каждый уничтоженный танк дается 10 очков. За каждый уничтоженный барьер - 5 очков. Игра заканчивается вместе со смертью игрока. Если игрок набирает больше очков, чем все предыдущие игроки, то открывается окно с рекордами и программа просит игрока ввести свое имя для последующего сохранения. Если игрок не побивает рекорда, то выводится сообщение о том, что игра завершена и программа просит нажать соответствующую клавишу для выхода в главное меню.

Листинг программы

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Media;

using System.IO;

namespace WindowsFormsApplication1

{

abstract class BasicBarrier

{

protected int X, Y;

protected Bitmap BarrierImage;

public bool Exist = false;

public BasicBarrier(int ix, int iy)

{

Exist = true;

X = ix;

Y = iy;

}

public event EventHandler Existing;

public void OnExisting(object sender, EventArgs ev)

{

if (Existing != null)

BarrierExisting(sender, ev);

}

public void BarrierExisting(object sender, EventArgs ev)

{

Exist = false;

}

public event CoordsEventHandler ShowPicture;

public void Show(object sender, CoordsEventArgs ev)

{

if (ShowPicture != null)

ShowPicture(sender, ev);

}

public void Groundbarriers_ShowPicture(object sender, CoordsEventArgs ev)

{

ev.Picture = BarrierImage;

ev.Exist = Exist;

//ev.Check = this.Y;

}

//public virtual void Show();

}

abstract class BasicPanzer

{

protected int X, Y, Direction, Steps = 0, Permission, OnShooting = 0;

protected System.Random rnd;

protected System.Drawing.Bitmap panzer;

protected bool iBullet = false, Exist = false;

public BasicPanzer(int ix, int iy)

{

Exist = true;

X = ix;

Y = iy;

}

virtual public event CoordsEventHandler TellCoords;

virtual public void OnTellCoords(object sender, CoordsEventArgs ev)

{

if (TellCoords != null)

TellCoords(sender, ev);

}

virtual public void Panzer_TellCoords(object sender, CoordsEventArgs ev)

{

ev.Y = Y;

ev.X = X;

ev.Exist = Exist;

ev.Picture = panzer;

ev.Direction = Direction;

ev.Shooting = iBullet;

if (iBullet == true)

OnShooting++;

}

virtual public void Panzer_Existing(object sender, EventArgs ev)

{

}

virtual public int CheckMoving(int iX, int iY, CoordsEventArgs[] MassivPictures, int[,] BarriersCoords, int iDirection, int Except, CoordsEventArgs InfoPlayer)

{

return 1;

}

}

[SerializableAttribute]

public struct Body

{

public string name;

public int count;

}

class Bullet

{

private int X, Y, Direction;

private Bitmap BulletImage;

public bool Exist, InMoving=false;

public Bullet()

{

Exist = false;

}

public void Engaging()

{

Exist = true;

}

public void Drawing(int ix, int iy, int iDirection)

{

Exist = true;

//s0.Play();

Direction = iDirection;

switch (iDirection)

{

case 0:

{

X = ix + 33;

Y = iy + 6;

BulletImage = Properties.Resources.Bullet;

break;

}

case 1:

{

X = ix - 3;

Y = iy + 6;

BulletImage = Properties.Resources.Bullet;

BulletImage.RotateFlip(RotateFlipType.Rotate180FlipNone);

break;

}

case 2:

{

X = ix + 6;

Y = iy + 33;

BulletImage = Properties.Resources.Bullet;

BulletImage.RotateFlip(RotateFlipType.Rotate90FlipNone);

break;

}

case 3:

{

X = ix + 6;

Y = iy - 3;

BulletImage = Properties.Resources.Bullet;

BulletImage.RotateFlip(RotateFlipType.Rotate270FlipNone);

break;

}

}

}

public void Moving(int Permission)

{

if (Permission == 1)

switch (Direction)

{

case 0:

{

X += 5;

break;

}

case 1: { X -= 5; break; }

case 2: { Y += 5; break; }

case 3: { Y -= 5; break; }

}

else

Exist = false;

}

public event CoordsEventHandler BulletCoordsEventHandler;

public void AboutCoords(object sender, CoordsEventArgs ev)

{

if (BulletCoordsEventHandler != null)

BulletCoordsEventHandler(sender, ev);

}

public void BulletCoords_EventHandler(object sender, CoordsEventArgs ev)

{

ev.X = X;

ev.Y = Y;

ev.Direction = Direction;

ev.Exist = Exist;

ev.Exist = Exist;

ev.Picture = BulletImage;

}

}

public class CoordsEventArgs:EventArgs

{

public int X, Y, Direction, Defention;

public System.Drawing.Bitmap Picture;

public bool Exist, InMoving, Shooting;

}

class GroundBarrier:BasicBarrier

{

public GroundBarrier(int ix, int iy):base(ix, iy)

{

BarrierImage = Properties.Resources.Block1;

}

}

class WaterBarrier:BasicBarrier

{

public WaterBarrier(int ix, int iy):base(ix,iy)

{

BarrierImage = Properties.Resources.Block2;

}

}

static void Main()

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(new Form1());

}

class PlayerPanzer:BasicPanzer

{

private int Defention=3;

public PlayerPanzer(int ix, int iy):base(ix, iy)

{

panzer = Properties.Resources.playerpanzer;

panzer.MakeTransparent();

}

virtual public int CheckMoving (int iX, int iY, CoordsEventArgs[] MassivPictures, int[,] BarriersCoords,int iDirection, int Except, CoordsEventArgs InfoPlayer)

{

Permission=1;

if (Except == 66)

Direction = iDirection;

switch (Direction)

{

case 0: //вправо

if (X + 15 > iX)

Permission = 2;

else

{

for (int i = 0; (i < 3) && (Permission == 1); i++)

if ((MassivPictures[i].Exist == true) && (X + 33 + 2 > MassivPictures[i].X) && (X < MassivPictures[i].X + 23) && (Y + 33 > MassivPictures[i].Y) && (Y < MassivPictures[i].Y + 33) && (i != Except))

Permission = 2;

for (int i = 0; (i < 28) && (Permission == 1); i++)

if ((BarriersCoords[2, i] == 1) && (BarriersCoords[0, i] - X - 33 - 2 < 0) && (Y + 21 - BarriersCoords[1, i] > 0) && (Y - BarriersCoords[1, i] - 24 < 0) && (X - BarriersCoords[0, i] - 28 < 0))

Permission = 0;

}

break;

case 1: //влево

if (X - 2 < 5)

Permission = 3;

else

{

for (int i = 0; (i < 3) && (Permission == 1); i++)

if ((MassivPictures[i].Exist==true)&&(X - 2 < MassivPictures[i].X + 23) && (X + 23 > MassivPictures[i].X) && (Y + 33 > MassivPictures[i].Y) && (Y < MassivPictures[i].Y + 33) && (i != Except))

Permission = 3;

for (int i = 0; (i < 28) && (Permission == 1); i++)

if ((BarriersCoords[2, i] == 1) && (X - BarriersCoords[0, i] - 29 < 0) && (Y + 21 - BarriersCoords[1, i] > 0) && (Y - BarriersCoords[1, i] - 23 < 0) && (BarriersCoords[0, i] - X - 20 < 3))

Permission = 0;

}

break;

case 2: //вниз

if (Y + 2 > iY)

Permission = 4;

else

{

for (int i = 0; (i < 3) && (Permission == 1); i++)

if ((MassivPictures[i].Exist == true) && (Y + 33 + 2 > MassivPictures[i].Y) && (Y < MassivPictures[i].Y + 33) && (X + 23 > MassivPictures[i].X) && (X < MassivPictures[i].X + 23) && (i != Except))

Permission = 4;

for (int i = 0; (i < 28) && (Permission == 1); i++)

if ((BarriersCoords[2, i] == 1) && (Y + 33 + 2 - BarriersCoords[1, i] > 0) && (X + 24 - BarriersCoords[0, i] > 0) && (X - BarriersCoords[0, i] - 28 < 0) && (Y - BarriersCoords[1, i] - 25 < 0))

Permission = 0;

}

break;

case 3:

if (Y - 4 < 5)

Permission = 5;

else

{

for (int i = 0; (i < 3) && (Permission == 1); i++)

if ((MassivPictures[i].Exist == true) && (Y - 2 < MassivPictures[i].Y + 33) && (Y + 33 > MassivPictures[i].Y) && (X + 23 > MassivPictures[i].X) && (X < MassivPictures[i].X + 23) && (i != Except))

Permission = 5;

for (int i = 0; (i < 28) && (Permission == 1); i++)

if ((BarriersCoords[2, i] == 1) && (Y - 2 - BarriersCoords[1, i] - 24 < 0) && (X + 23 - BarriersCoords[0, i] > 0) && (X - BarriersCoords[0, i] - 28 < 0) && (Y + 21 - BarriersCoords[1, i] > 0))

Permission=0;

}

break;

}

if (Permission == 1)

{

switch (Direction)

{

case 0:

{

X += 2;

panzer = Properties.Resources.playerpanzer;

panzer.RotateFlip(RotateFlipType.Rotate270FlipNone);

break; //вправо

}

case 1:

{

X -= 2;

panzer = Properties.Resources.playerpanzer;

panzer.RotateFlip(RotateFlipType.Rotate90FlipNone);

break; //влево

}

case 2:

{

Y += 2;

panzer = Properties.Resources.playerpanzer;

break; //вниз

}

case 3:

{

Y -= 2;

panzer = Properties.Resources.playerpanzer;

panzer.RotateFlip(RotateFlipType.Rotate180FlipNone);

break;

}

}

}

return 1;

}

public void ExistingShoot(CoordsEventArgs ev)

{

iBullet = ev.Exist;

}

public event EventHandler PanzerExisting;

public void OnExisting(object sender, EventArgs ev)

{

if (PanzerExisting != null)

PanzerExisting(sender, ev);

}

virtual public void Panzer_Existing(object sender, EventArgs ev)

{

//Exist = false;

if (Defention > 0)

Defention--;

}

public event DefendEventHandler PanzerDefend;

public void OnDefend(object sender, DefendEventArgs ev)

{

if (PanzerDefend != null)

PanzerDefend(sender, ev);

}

public void Panzer_Defend(object sender, DefendEventArgs ev)

{

ev.Defention = Defention;

}

}

class Panzer:BasicPanzer

{

public Panzer(int ix, int iy) : base(ix, iy)

{

panzer = Properties.Resources.panzer;

panzer.MakeTransparent();

}

public void ChooseDirection()

{

if (Steps == 0)

{

if (Permission==0)

{

rnd = new System.Random();

Direction = rnd.Next(4);

}

else

switch (Permission)

{

case 2: Direction = 1; break;

case 3: Direction = 0; break;

case 4: Direction = 3; break;

case 5: Direction = 2; break;

}

}

}

virtual public int CheckMoving (int iX, int iY, CoordsEventArgs[] MassivPictures, int[,] BarriersCoords,int iDirection, int Except, CoordsEventArgs InfoPlayer)

{

Permission=1;// Permission = 0 - разрешить движение

//Direction =2;

if (Except == 66)

Direction = iDirection;

switch (Direction)

{

case 0: //вправо

if (X + 15 > iX)

Permission = 2;

else

{

for (int i = 0; (i < 3) && (Permission == 1); i++)

if ((MassivPictures[i].Exist == true) && (X + 33 + 2 > MassivPictures[i].X) && (X < MassivPictures[i].X + 23) && (Y + 33 > MassivPictures[i].Y) && (Y < MassivPictures[i].Y + 33) && (i != Except))

Permission = 2;

for (int i = 0; (i < 28) && (Permission == 1); i++)

if ((BarriersCoords[2, i] == 1) && (BarriersCoords[0, i] - X - 33 - 2 < 0) && (Y + 21 - BarriersCoords[1, i] > 0) && (Y - BarriersCoords[1, i] - 24 < 0) && (X - BarriersCoords[0, i] - 28 < 0))

Permission = 0;

if ((Permission == 1) && (X + 33 + 2 > InfoPlayer.X) && (X < InfoPlayer.X + 23) && (Y + 33 > InfoPlayer.Y) && (Y < InfoPlayer.Y + 33)&&(Except!=66))

Permission = 2;

if (iBullet==false)

Shooting(InfoPlayer);

}

break;

case 1: //влево

if (X - 2 < 5)

Permission = 3;

else

{

for (int i = 0; (i < 3) && (Permission == 1); i++)

if ((MassivPictures[i].Exist==true)&&(X - 2 < MassivPictures[i].X + 23) && (X + 23 > MassivPictures[i].X) && (Y + 33 > MassivPictures[i].Y) && (Y < MassivPictures[i].Y + 33) && (i != Except))

Permission = 3;

for (int i = 0; (i < 28) && (Permission == 1); i++)

if ((BarriersCoords[2, i] == 1) && (X - BarriersCoords[0, i] - 29 < 0) && (Y + 21 - BarriersCoords[1, i] > 0) && (Y - BarriersCoords[1, i] - 23 < 0) && (BarriersCoords[0, i] - X - 20 < 3))

Permission = 0;

if ((Permission == 1) && (X - 2 < InfoPlayer.X+23) && (X +23< InfoPlayer.X ) && (Y + 33 > InfoPlayer.Y) && (Y < InfoPlayer.Y + 33) && (Except != 66))

Permission = 3;

if (iBullet == false)

Shooting(InfoPlayer);

}

break;

case 2: //вниз

if (Y + 2 > iY)

Permission = 4;

else

{

for (int i = 0; (i < 3) && (Permission == 1); i++)

if ((MassivPictures[i].Exist == true) && (Y + 33 + 2 > MassivPictures[i].Y) && (Y < MassivPictures[i].Y + 33) && (X + 23 > MassivPictures[i].X) && (X < MassivPictures[i].X + 23) && (i != Except))

Permission = 4;

for (int i = 0; (i < 28) && (Permission == 1); i++)

if ((BarriersCoords[2, i] == 1) && (Y + 33 + 2 - BarriersCoords[1, i] > 0) && (X + 24 - BarriersCoords[0, i] > 0) && (X - BarriersCoords[0, i] - 28 < 0) && (Y - BarriersCoords[1, i] - 25 < 0))

Permission = 0;

if (iBullet == false)

Shooting(InfoPlayer);

if ((Permission == 1) && (Y + 33 + 2 > InfoPlayer.X) && (Y < InfoPlayer.X + 33) && (X + 23 > InfoPlayer.X) && (X < InfoPlayer.X + 23) && (Except != 66))

Permission = 4;

}

break;

case 3:

if (Y - 4 < 5)

Permission = 5;

else

{

for (int i = 0; (i < 3) && (Permission == 1); i++)

if ((MassivPictures[i].Exist == true) && (Y - 2 < MassivPictures[i].Y + 33) && (Y + 33 > MassivPictures[i].Y) && (X + 23 > MassivPictures[i].X) && (X < MassivPictures[i].X + 23) && (i != Except))

Permission = 5;

for (int i = 0; (i < 28) && (Permission == 1); i++)

if ((BarriersCoords[2, i] == 1) && (Y - 2 - BarriersCoords[1, i] - 24 < 0) && (X + 23 - BarriersCoords[0, i] > 0) && (X - BarriersCoords[0, i] - 28 < 0) && (Y + 21 - BarriersCoords[1, i] > 0))

Permission=0;

if (iBullet == false)

Shooting(InfoPlayer);

if ((Permission == 1) && (Y-2 > InfoPlayer.Y+33) && (Y+33 < InfoPlayer.Y) && (X+ 23 > InfoPlayer.X) && (X < InfoPlayer.X+23) && (Except != 66))

Permission = 5;

}

break;

}

if (Permission == 1)

{

switch (Direction)

{

case 0:

{

X += 1;

panzer = Properties.Resources.panzer;

panzer.RotateFlip(RotateFlipType.Rotate270FlipNone);

break; //вправо

}

case 1:

{

X -= 1;

panzer = Properties.Resources.panzer;

panzer.RotateFlip(RotateFlipType.Rotate90FlipNone);

break; //влево

}

case 2:

{

Y += 1;

panzer = Properties.Resources.panzer;

break; //вниз

}

case 3:

{

Y -= 1;

panzer = Properties.Resources.panzer;

panzer.RotateFlip(RotateFlipType.Rotate180FlipNone);

break;

}

}

Steps++;

}

if (Steps == 50)

{

Permission = 0;

Steps = 0;

}

if (Permission!=1)

Steps = 0;

return (Permission);

}

/*public event CoordsEventHandler TellCoords;

public void OnTellCoords(object sender, CoordsEventArgs ev)

{

if (TellCoords != null)

TellCoords(sender, ev);

}

public void Panzer_TellCoords(object sender, CoordsEventArgs ev)

{

ev.Y = Y;

ev.X = X;

ev.Exist = Exist;

ev.Picture = panzer;

ev.Direction = Direction;

ev.Shooting = iBullet;

if (iBullet==true)

OnShooting++;

}*/

public void Shooting(CoordsEventArgs InfoPlayer)

{

//int TurnDirection=42;

if ((X + 10 < InfoPlayer.X) && (Y + 6 > InfoPlayer.Y) && (Y + 6 < InfoPlayer.Y + 30))

{

Direction = 0;

Steps = 1;

iBullet = true;

}

if ((X + 10 > InfoPlayer.X) && (Y + 6 > InfoPlayer.Y) && (Y + 6 < InfoPlayer.Y + 30))

{

Direction = 1;

Steps = 1;

iBullet = true;

}

if ((Y + 10 < InfoPlayer.Y) && (X + 6 > InfoPlayer.X) && (X + 6 < InfoPlayer.X + 30))

{

Direction = 2;

Steps = 1;

iBullet = true;

}

if ((Y + 10 > InfoPlayer.Y) && (X + 6 > InfoPlayer.X) && (X + 6 < InfoPlayer.X + 30))

{

Direction = 3;

Steps = 1;

iBullet = true;

}

}

public void ExistingShoot(CoordsEventArgs ev)

{

iBullet = ev.Exist;

}

public event EventHandler PanzerExisting;

public void OnExisting(object sender, EventArgs ev)

{

if (PanzerExisting != null)

PanzerExisting(sender, ev);

}

virtual public void Panzer_Existing(object sender, EventArgs ev)

{

//Exist = false;

X = 420; Y = 420;

}

}

class FormRecords:Form

{

Body[] Records = new Body[5];

Label[,] label1 = new Label[5,2];

private TextBox textBox1;

private Button button1;

private string score, Name;

public FormRecords(int Count)

{

int CheckingCount = Count;

this.button1 = new System.Windows.Forms.Button();

this.button1.Location = new System.Drawing.Point(102, 188);

this.button1.Name = "button1";

this.button1.Size = new System.Drawing.Size(91, 29);

this.button1.TabIndex = 0;

this.button1.Text = "OK";

this.button1.UseVisualStyleBackColor = true;

this.button1.Click += new System.EventHandler(this.button1_Click);

this.Controls.Add(button1);

string checking = " ";

string count = "";

int Permission = 0, j = 0;

for (int i = 0; i < 5; i++)

for (int a=0; a<2; a++)

label1[i,a] = new Label();

for (int i = 0; i < 5; i++)

{

Records[i] = new Body();

Records[i].name = "";

}

/*StreamWriter sr1 = new StreamWriter(@"C:\TextRecords.bin");

sr1.WriteLine("Игрок1 0");

sr1.WriteLine("Игрок2 0");

sr1.WriteLine("Игрок3 0");

sr1.WriteLine("Игрок4 0");

sr1.WriteLine("Игрок5 0");

sr1.Close();*/

int NumberofRecord = 0;

StreamReader sr = new StreamReader(@"C:\TextRecords.bin");

while (sr.EndOfStream != true)

{

score = sr.ReadLine();

j = 0;

Permission = 0;

count = "";

for (int i = 0; i < score.Length; i++)

{

if (Permission == 1)

{

count += score[i];

j++;

}

if (score[i].CompareTo(checking[0]) == 0)

Permission++;

else

if (Permission==0)

Records[NumberofRecord].name += score[i];

}

Records[NumberofRecord].count = Convert.ToInt32(count);

NumberofRecord++;

}

Body buffer = new Body();

for (int z = 0; z < 5; z++ )

{

for (int i = 0; i < 4; i++)

{

if (Records[i + 1].count > Records[i].count)

{

buffer = Records[i];

Records[i] = Records[i + 1];

Records[i + 1] = buffer;

}

}

for (int i = 2; i > 0; i--)

{

if (Records[i - 1].count < Records[i].count)

{

buffer = Records[i];

Records[i] = Records[i - 1];

Records[i - 1] = buffer;

}

}

}

sr.Close();

//if (CheckingCount > Records[0].count)

//{

for (int i = 4; i > 0; i--)

Records[i] = Records[i - 1];

Records[0].count = CheckingCount;

this.textBox1 = new System.Windows.Forms.TextBox();

this.textBox1.Location = new System.Drawing.Point(80, 50);

this.textBox1.Name = "textBox1";

this.textBox1.Size = new System.Drawing.Size(100, 17);

this.textBox1.TabIndex = 0;

this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);

this.Controls.Add(this.textBox1);

//}

int Y = 50;

for (int i = 0; i < 5; i++)

{

//if (Records[i].count != 0)

//{

label1[i, 0].Text = Records[i].name;

label1[i, 0].Location = new Point(80, Y);

label1[i, 0].Size = new Size(100, 20);

label1[i, 1].Text = Convert.ToString(Records[i].count);

label1[i, 1].Location = new Point(190, Y);

label1[i, 1].Size = new Size(50, 20);

this.Controls.Add(label1[i, 0]);

this.Controls.Add(label1[i, 1]);

Y += 20;

//}

}

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

Records[0].name = textBox1.Text;

}

private void button1_Click(object sender, EventArgs e)

{

this.Close();

WritingFile();

}

public void WritingFile()

{

string Line = "";

StreamWriter sr1 = new StreamWriter(@"C:\TextRecords.bin");

for (int i = 0; i < 5; i++)

{

Line = "";

Line += Records[i].name;

Line += " ";

Line += Convert.ToString(Records[i].count);

sr1.WriteLine(Line);

}

sr1.Close();

}

}

class FormInfo:Form

{

public FormInfo()

{

this.FormBorderStyle = FormBorderStyle.Fixed3D;

this.Text = "О программе";

this.MaximizeBox = false;

this.Width = 250;

this.Height = 220;

Label LabelInfo = new Label();

LabelInfo.Font = new System.Drawing.Font("Microsoft Sens Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

LabelInfo.Text = "Наименование: BATTLE CITY (NES) \n Разработчик: Жалков Н. А. \n студент гр.2-42 \n ИГЭУ ПОКС 2012";

LabelInfo.TextAlign = ContentAlignment.MiddleCenter;

LabelInfo.Size = new Size(250, 250);

LabelInfo.Location = new Point(1, 1);

PictureBox Symbol = new PictureBox();

Symbol.SizeMode = PictureBoxSizeMode.StretchImage;

Symbol.Size = new Size(150, 50);

Symbol.Location = new Point(45, 30);

Bitmap bulletimage = Properties.Resources.symbol;

Symbol.Image = (Image)bulletimage;

this.Controls.Add(Symbol);

this.Controls.Add(LabelInfo);

}

}

class FormHelp:Form

{

public FormHelp()

{

this.FormBorderStyle = FormBorderStyle.Fixed3D;

this.Text = "Manual";

this.MaximizeBox = false;

this.Width = 270;

this.Height = 320;

Label LabelInfo = new Label();

LabelInfo.Font = new System.Drawing.Font("Microsoft Sens Serif", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));

LabelInfo.Text = "Управление: навигационные стрелки \n Выстрел: Пробел \n Перед выстрелом указать направление выстрела нажав на соответствующую навигационную клавишу \n Игрок имеет в запасе броню, рассчитанную на 3 попадания \n Игра заканчивается тогда, когда игрок погибает";

LabelInfo.TextAlign = ContentAlignment.TopCenter;

LabelInfo.Size = new Size(250, 250);

LabelInfo.Location = new Point(1, 30);

this.Controls.Add(LabelInfo);

}

}

public delegate void CoordsEventHandler (object sender, CoordsEventArgs ev);

public delegate void DefendEventHandler(object sender, DefendEventArgs ev);

//public delegate void InformationEventHandler(object sender, InformationEventArgs ev);

public partial class Form1 : Form

{

public System.Drawing.Bitmap panzer, background= Properties.Resources.sky, ground;

private SoundPlayer sp = new SoundPlayer(Properties.Resources.e2m3);

private SoundPlayer s0 = new SoundPlayer(Properties.Resources.s0);

private Label LabelCount, LabelCount1, LabelLives1, LabelLives, LabelInfo;

private Graphics g;

private Rectangle rct;

private int Permission=1, Count;

private Panzer[] Panzer=new Panzer[3];

private PlayerPanzer PlayerPanzer;

private GroundBarrier[] GroundBarriers = new GroundBarrier[24];

private WaterBarrier[] WaterBarriers = new WaterBarrier[4];

private Bullet[] MassiveBullets = new Bullet[4];

private int[,] BarriersCoords = new int[3,30];

private CoordsEventArgs[] MassivPictures = new CoordsEventArgs[3];

private CoordsEventArgs InfoPlayer = new CoordsEventArgs();

private PictureBox PictureWall, TextOnScreen;

private Button ButStart, ButExit, ButOptions, ButHelp, ButInfo, Button1, Button2, Button3;

private Timer Timer2 = new Timer(), Timer3 = new Timer();

static Keys Key1;

public Form1()

{

InitializeComponent();

this.FormClosing += new FormClosingEventHandler(Form1_FormClosing);

this.Width = 610;

this.Height = 537;

PictureWall = new PictureBox();

LabelCount = new Label();

LabelCount.Location = new Point(450, 40);

LabelCount.TextAlign = System.Drawing.ContentAlignment.TopRight;

LabelCount.Image = Properties.Resources.sky1;

LabelCount.Text = "СЧЕТ:";

LabelCount.Size = new System.Drawing.Size(80, 24);

LabelCount.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,((byte)(250)));

LabelCount1 = new Label();

LabelCount1.Location = new Point(450, 70);

LabelCount1.TextAlign = System.Drawing.ContentAlignment.TopRight;

LabelCount1.Image = Properties.Resources.sky1;

LabelCount1.Text = "0";

LabelCount1.Size = new System.Drawing.Size(80, 24);

LabelCount1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(250)));

LabelLives = new Label();

LabelLives.Location = new Point(441, 120);

LabelLives.TextAlign = System.Drawing.ContentAlignment.TopLeft;

LabelLives.Image = Properties.Resources.sky1;

LabelLives.Text = "БРОНЯ";

LabelLives.Size = new System.Drawing.Size(110, 24);

LabelLives.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(250)));

LabelLives1 = new Label();

LabelLives1.Location = new Point(450, 150);

LabelLives1.TextAlign = System.Drawing.ContentAlignment.TopRight;

LabelLives1.Image = Properties.Resources.sky1;

LabelLives1.Text = "3";

LabelLives1.Size = new System.Drawing.Size(80, 24);

LabelLives1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(250)));

Timer2.Tick += new EventHandler(Timer2_Tick);

Timer2.Interval = 5;

Timer2.Enabled = false;

this.KeyDown += new KeyEventHandler(Form1_KeyDown);

Timer3.Tick += new EventHandler(Timer3_Tick);

Timer3.Interval = 20;

Timer3.Enabled = false;

DrawingMainMenu();

}

virtual public void DrawingMainMenu()

{

this.Width = 600;

this.Height = 530;

//FormRecords frm1 = new FormRecords(Count);

//frm1.ShowDialog();

this.Controls.Add(LabelInfo);

this.Controls.Add(ButStart);

this.Controls.Add(ButOptions);

this.Controls.Add(ButHelp);

this.Controls.Add(ButInfo);

this.Controls.Add(ButExit);

this.MaximizeBox = false;

PictureWall.SizeMode = PictureBoxSizeMode.StretchImage;

PictureWall.Size = new Size(600, 500);

PictureWall.Location = new Point(0, 0);

Bitmap bulletimage = Properties.Resources.tankwall;

PictureWall.Image = (Image)bulletimage;

this.Controls.Add(PictureWall);

}

public void ButInfo_Click(object sender, EventArgs e)

{

FormInfo frm = new FormInfo();

frm.ShowDialog();

}

public void ButHelp_Click(object sender, EventArgs e)

{

FormHelp frm = new FormHelp();

frm.ShowDialog();

}

public void ButOptions_Click(object sender, EventArgs e)

{

this.Controls.Remove(PictureWall);

this.Controls.Remove(ButExit);

this.Controls.Remove(ButStart);

this.Controls.Remove(ButOptions);

this.Controls.Remove(ButInfo);

this.Controls.Remove(ButHelp);

TextOnScreen = new PictureBox();

TextOnScreen.SizeMode = PictureBoxSizeMode.StretchImage;

TextOnScreen.Size = new Size(400, 50);

TextOnScreen.Location = new Point(100, 40);

Bitmap bulletimage = Properties.Resources.FonText;

TextOnScreen.Image = (Image)bulletimage;

this.Controls.Add(TextOnScreen);

Button1 = new Button();

Button1.Size = new Size(120, 120);

Button1.Location = new Point(40, 200);

Button1.BackgroundImage = Properties.Resources.Sky_Small;

Button1.Click += new EventHandler(Button1_Click);

this.Controls.Add(Button1);

Button2 = new Button();

Button2.Size = new Size(120, 120);

Button2.Location = new Point(240, 200);

Button2.BackgroundImage = Properties.Resources.Jungle_Small;

Button2.Click += new EventHandler(Button2_Click);

this.Controls.Add(Button2);

Button3 = new Button();

Button3.Size = new Size(120, 120);

Button3.Location = new Point(440, 200);

Button3.BackgroundImage = Properties.Resources.DesertSmall;

Button3.Click += new EventHandler(Button3_Click);

this.Controls.Add(Button3);

}

void Button1_Click(object sender, EventArgs e)

{

background = Properties.Resources.sky;

this.Controls.Remove(TextOnScreen);

this.Controls.Remove(Button1);

this.Controls.Remove(Button2);

this.Controls.Remove(Button3);

this.DrawingMainMenu();

}

void Button2_Click(object sender, EventArgs e)

{

// background = Properties.Resources.Jungle;

background = Properties.Resources.Desert;

this.Controls.Remove(TextOnScreen);

this.Controls.Remove(Button1);

this.Controls.Remove(Button2);

this.Controls.Remove(Button3);

this.DrawingMainMenu();

}

void Button3_Click(object sender, EventArgs e)

{

//background = Properties.Resources.Desert;

background = Properties.Resources.Jungle1;

this.Controls.Remove(TextOnScreen);

this.Controls.Remove(Button1);

this.Controls.Remove(Button2);

this.Controls.Remove(Button3);

this.DrawingMainMenu();

}

public void ButExit_Click(object sender, EventArgs e)

{

this.Close();

}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)

{

var result = MessageBox.Show("Вы уверены?", "Внимание", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

if (result != DialogResult.Yes)

e.Cancel = true;

}

public void ButStart_Click(object sender, EventArgs e)

{

this.Controls.Remove(PictureWall);

this.Controls.Remove(ButExit);

this.Controls.Remove(ButStart);

this.Controls.Remove(ButOptions);

this.Controls.Remove(ButInfo);

this.Controls.Remove(ButHelp);

sp.Play();

//background = Properties.Resources.sky;

this.BackgroundImage = Properties.Resources.sky1;

this.ClientSize = new Size(new Point(BackgroundImage.Width, BackgroundImage.Height));

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;

this.MaximizeBox = false;

g = Graphics.FromImage(BackgroundImage);

int X = 20, Y = 20;

for (int i = 0; i < 3; i++)

{

MassivPictures[i] = new CoordsEventArgs();

Panzer[i] = new Panzer(X, Y);

Panzer[i].TellCoords += new CoordsEventHandler(Panzer[i].Panzer_TellCoords);

Panzer[i].PanzerExisting += new EventHandler(Panzer[i].Panzer_Existing);

X += 70;

}

for (int i = 0; i < 4; i++)

{

MassiveBullets[i] = new Bullet();

MassiveBullets[i].BulletCoordsEventHandler += new CoordsEventHandler(MassiveBullets[i].BulletCoords_EventHandler);

}

PlayerPanzer = new PlayerPanzer(400, 400);

PlayerPanzer.TellCoords += new CoordsEventHandler(PlayerPanzer.Panzer_TellCoords);

PlayerPanzer.PanzerExisting += new EventHandler(PlayerPanzer.Panzer_Existing);

PlayerPanzer.PanzerDefend += new DefendEventHandler(PlayerPanzer.Panzer_Defend);

X = 90; Y = 90;

for (int i = 0; i < 24; i++)

{

GroundBarriers[i] = new GroundBarrier(X, Y);

GroundBarriers[i].ShowPicture += new CoordsEventHandler(GroundBarriers[i].Groundbarriers_ShowPicture);

GroundBarriers[i].Existing += new EventHandler(GroundBarriers[i].BarrierExisting);

BarriersCoords[0, i] = X;

BarriersCoords[1, i] = Y;

BarriersCoords[2, i] = 1;

Y += 25;

if (i == 11)

{

X = 320;

Y = 90;

}

}

X = 200; Y = 200;

for (int i = 24; i < 28; i++)

{

WaterBarriers[i - 24] = new WaterBarrier(X, Y);

WaterBarriers[i - 24].ShowPicture += new CoordsEventHandler(WaterBarriers[i-24].Groundbarriers_ShowPicture);

WaterBarriers[i - 24].Existing += new EventHandler(WaterBarriers[i-24].BarrierExisting);

BarriersCoords[0, i] = X;

BarriersCoords[1, i] = Y;

BarriersCoords[2, i] = 1;

X += 24;

if (i == 25)

{

X = 200;

Y = 223;

}

}

Rectangle reg = new Rectangle(0, 0, background.Width - 90, background.Height - 1);

g.DrawRectangle(Pens.Black, reg.X, reg.Y, reg.Width, reg.Height);

Timer2.Enabled = true;

this.KeyDown += new KeyEventHandler(Form1_KeyDown);

Timer3.Enabled = true;

/*Timer4.Tick += new EventHandler(Timer4_Tick);

Timer4.Interval = 1;

Timer4.Enabled = true;*/

}

public void Timer2_Tick (object sender, EventArgs e)

{

g.DrawImage (background, new Point(0,0));

CoordsEventArgs ev;

for (int j = 0; j < 3; j++)

{

ev = new CoordsEventArgs();

Panzer[j].OnTellCoords(this, ev);

MassivPictures[j] = ev;

}

for (int i = 0; i < 3; i++)

{

if (MassivPictures[i].Exist==true)

{

Panzer[i].ChooseDirection();

PlayerPanzer.OnTellCoords(this, InfoPlayer);

Permission = Panzer[i].CheckMoving(background.Width - 112, background.Height - 34, MassivPictures, BarriersCoords, 0, i, InfoPlayer);

CoordsEventArgs ev1 = new CoordsEventArgs();

Panzer[i].OnTellCoords(this, ev1);

MassivPictures[i] = ev1;

}

}

this.Drawing();

}

public void Timer3_Tick(object sender, EventArgs e)

{

CoordsEventArgs evbull = new CoordsEventArgs();

CoordsEventArgs evbull1 = new CoordsEventArgs();

for (int i = 0; i < 3; i++)

{

Panzer[i].OnTellCoords(this, evbull);

MassiveBullets[i].AboutCoords(this, evbull1);

if ((evbull.Shooting == true)&&(MassiveBullets[i].Exist==false))

MassiveBullets[i].Drawing(evbull.X, evbull.Y, evbull.Direction);

}

for (int i = 0; i < 4; i++)

{

CoordsEventArgs ev1 = new CoordsEventArgs();

MassiveBullets[i].AboutCoords(this, ev1);

if (ev1.Exist == true)

{

Permission = 1;

switch (ev1.Direction)

{

case 0:

{

if (ev1.X + 2 > background.Width - 85)

{

Permission = 2;

}

for (int j = 0; (j < 24) && (Permission == 1); j++)

{

if ((BarriersCoords[2, j] == 1) && (BarriersCoords[0, j] - ev1.X - 5 < 0) && (ev1.X - BarriersCoords[0, j] - 28 < 0) && (ev1.Y + 7 - BarriersCoords[1, j] > 0) && (ev1.Y - BarriersCoords[1, j] - 28 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

GroundBarriers[j].OnExisting(this, ev);

}

}

if ((i == 3) && (Permission == 1))

CheckShooting(ev1);

else

if (i < 3)

{

CheckShootingGLaDOS(ev1);

}

break;

}

case 1:

{

if (ev1.X - 2 < 5)

{

Permission = 2;

}

for (int j = 0; (j < 24) && (Permission == 1); j++)

{

if ((BarriersCoords[2, j] == 1) && (BarriersCoords[0, j] + 23 - ev1.X - 5 > 0) && (ev1.X - BarriersCoords[0, j] > 0) && (ev1.Y + 7 - BarriersCoords[1, j] > 0) && (ev1.Y - BarriersCoords[1, j] - 28 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

GroundBarriers[j].OnExisting(this, ev);

}

}

if ((i == 3) && (Permission == 1))

CheckShooting(ev1);

else

if (i < 3)

{

CheckShootingGLaDOS(ev1);

}

break;

}

case 2:

{

if (ev1.Y + 2 > background.Height - 15)

{

Permission = 2;

}

for (int j = 0; (j < 24) && (Permission == 1); j++)

{

if ((BarriersCoords[2,j]==1) && (BarriersCoords[1, j] - ev1.Y - 5 < 0) && (ev1.Y - BarriersCoords[1, j] - 28 < 0) && (ev1.X + 5 - BarriersCoords[0, j] > 0) && (ev1.X - BarriersCoords[0, j] - 28 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

GroundBarriers[j].OnExisting(this, ev);

}

}

if ((i == 3) && (Permission == 1))

CheckShooting(ev1);

else

if (i < 3)

{

CheckShootingGLaDOS(ev1);

}

break;

}

case 3:

{

if (ev1.Y - 2 < 5)

{

Permission = 2;

}

for (int j = 0; (j < 24) && (Permission == 1); j++)

{

if ((BarriersCoords[2, j] == 1) && (BarriersCoords[0, j] + 23 - ev1.X - 5 > 0) && (ev1.X - BarriersCoords[0, j] > 0) && (ev1.Y + 7 - BarriersCoords[1, j] > 0) && (ev1.Y - BarriersCoords[1, j] - 28 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

GroundBarriers[j].OnExisting(this, ev);

}

}

if ((i == 3) && (Permission == 1))

CheckShooting(ev1);

else

if (i < 3)

{

CheckShootingGLaDOS(ev1);

}

break;

}

}

MassiveBullets[i].Moving(Permission);

MassiveBullets[i].AboutCoords(this, evbull1);

if (i<3)

Panzer[i].ExistingShoot(evbull1);

}

}

}

void Form1_KeyDown(object sender, KeyEventArgs e)

{

//Key1 = e.KeyCode;

int Direction=42;

CoordsEventArgs ev1 = new CoordsEventArgs();

PlayerPanzer.OnTellCoords(this, ev1);

switch (e.KeyCode)

{

case Keys.Right: Direction=0; break;

case Keys.Left: Direction=1; break;

case Keys.Down: Direction=2; break;

case Keys.Up: Direction=3; break;

case Keys.Escape:

{

ClearPlayground();

DrawingMainMenu();

break;

}

}

CoordsEventArgs ev2 = new CoordsEventArgs();

MassiveBullets[3].AboutCoords(this, ev2);

if (ev2.Exist==false)

if (e.KeyCode == Keys.Space)

{

//s0.Play();

MassiveBullets[3].Drawing(ev1.X, ev1.Y, ev1.Direction);

}

PlayerPanzer.CheckMoving(background.Width - 112, background.Height - 34, MassivPictures, BarriersCoords, Direction, 66, InfoPlayer);

PlayerPanzer.OnTellCoords(this, InfoPlayer);

}

public void Timer4_Tick(object sender, EventArgs e)

{

for (int i = 0; i < 24; i++)

{

CoordsEventArgs ev2 = new CoordsEventArgs();

GroundBarriers[i].Show(this, ev2);

g.DrawImage(ev2.Picture, BarriersCoords[0, i], BarriersCoords[1, i]);

}

Rectangle reg = new Rectangle(0, 0, background.Width - 90, background.Height - 1);

g.DrawRectangle(Pens.Black, reg.X, reg.Y, reg.Width, reg.Height);

this.Invalidate(reg);

}

public void Drawing()

{

string arr = Count.ToString();

LabelCount1.Text = arr;

LabelCount1.Text = arr;

DefendEventArgs ev4 = new DefendEventArgs();

PlayerPanzer.OnDefend(this, ev4);

string arr1 = ev4.Defention.ToString();

LabelLives1.Text = arr1;

this.Controls.Add(LabelCount);

this.Controls.Add(LabelCount1);

this.Controls.Add(LabelLives);

this.Controls.Add(LabelLives1);

for (int i = 0; i < 24; i++)

{

CoordsEventArgs ev2 = new CoordsEventArgs();

GroundBarriers[i].Show(this, ev2);

if (ev2.Exist == true)

g.DrawImage(ev2.Picture, BarriersCoords[0, i], BarriersCoords[1, i]);

else

BarriersCoords[2, i] = 0;

}

for (int i = 24; i < 28; i++)

{

CoordsEventArgs ev2 = new CoordsEventArgs();

WaterBarriers[i-24].Show(this, ev2);

if (ev2.Exist == true)

g.DrawImage(ev2.Picture, BarriersCoords[0, i], BarriersCoords[1, i]);

else

BarriersCoords[2, i] = 0;

}

for (int i = 0; i < 3; i++)

{

CoordsEventArgs ev1 = new CoordsEventArgs();

Panzer[i].OnTellCoords(this, ev1);

if (ev1.Exist == true)

g.DrawImage(MassivPictures[i].Picture, MassivPictures[i].X, MassivPictures[i].Y);

}

ev4 = new DefendEventArgs();

PlayerPanzer.OnDefend(this, ev4);

if (ev4.Defention != 0)

{

CoordsEventArgs ev3 = new CoordsEventArgs();

PlayerPanzer.OnTellCoords(this, ev3);

g.DrawImage(ev3.Picture, ev3.X, ev3.Y);

}

else

{

Count = 0;

ClearPlayground();

DrawingMainMenu();

}

for (int i = 0; i < 4; i++)

{

CoordsEventArgs ev1 = new CoordsEventArgs();

MassiveBullets[i].AboutCoords(this, ev1);

if (ev1.Exist == true)

g.DrawImage(ev1.Picture, ev1.X, ev1.Y);

}

Rectangle reg = new Rectangle(0, 0, background.Width - 90, background.Height - 1);

g.DrawRectangle(Pens.Black, reg.X, reg.Y, reg.Width, reg.Height);

this.Invalidate(reg);

}

void ClearPlayground()

{

sp.Stop();

Timer2.Enabled = false;

Timer3.Enabled = false;

Body[] Records = new Body[5];

for (int i = 0; i < 5; i++)

{

Records[i] = new Body();

Records[i].name = "";

}

StreamReader sr = new StreamReader(@"C:\TextRecords.bin");

string score ,count, checking =" ";

int Permission = 0, j = 0, NumberofRecord = 0;

while (sr.EndOfStream != true)

{

score = sr.ReadLine();

j = 0;

Permission = 0;

count = "";

for (int i = 0; i < score.Length; i++)

{

if (Permission == 1)

{

count += score[i];

j++;

}

if (score[i].CompareTo(checking[0]) == 0)

Permission++;

}

Records[NumberofRecord].count = Convert.ToInt32(count);

NumberofRecord++;

}

sr.Close();

if (Count > Records[0].count)

{

FormRecords frm1 = new FormRecords(Count);

frm1.ShowDialog();

}

else

{

FormGameOver frm = new FormGameOver();

frm.ShowDialog();

}

this.Controls.Remove(LabelCount);

this.Controls.Remove(LabelCount1);

this.Controls.Remove(LabelLives);

this.Controls.Remove(LabelLives1);

g.Clear(Color.FloralWhite);

//Timer2.Stop();

//Timer3.Stop();

//Timer2.Dispose();

//Timer3.Dispose();

this.KeyDown -= new KeyEventHandler(Form1_KeyDown);

}

public void CheckShootingGLaDOS(CoordsEventArgs ev1)

{

CoordsEventArgs evbull = new CoordsEventArgs();

PlayerPanzer.OnTellCoords(this, evbull);

switch (evbull.Direction)

{

case 0:

{

if ((ev1.X + 5 - evbull.X > 0) && (ev1.X - evbull.X - 31 < 0) && (ev1.Y + 3 - evbull.Y > 0) && (ev1.Y - evbull.Y - 20 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

PlayerPanzer.OnExisting(this, ev);

}

break;

}

case 1:

{

if ((ev1.X + 5 - evbull.X > 0) && (ev1.X - evbull.X - 31 < 0) && (ev1.Y + 3 - evbull.Y > 0) && (ev1.Y - evbull.Y - 20 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

PlayerPanzer.OnExisting(this, ev);

}

break;

}

case 2:

{

if ( (ev1.X + 5 - evbull.X > 0) && (ev1.X - evbull.X - 21 < 0) && (ev1.Y + 3 - evbull.Y > 0) && (ev1.Y - evbull.Y - 31 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

PlayerPanzer.OnExisting(this, ev);

}

break;

}

case 3:

{

if ( (ev1.X + 5 - evbull.X > 0) && (ev1.X - evbull.X - 21 < 0) && (ev1.Y + 3 - evbull.Y > 0) && (ev1.Y - evbull.Y - 31 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

PlayerPanzer.OnExisting(this, ev);

}

break;

}

}

}

public void CheckShooting(CoordsEventArgs ev1)

{

CoordsEventArgs evbull = new CoordsEventArgs();

for (int j = 0; j < 3; j++)

{

Panzer[j].OnTellCoords(this, evbull);

switch (evbull.Direction)

{

case 0:

{

if ((evbull.Exist == true) && (ev1.X + 5 - evbull.X > 0) && (ev1.X - evbull.X - 31 < 0) && (ev1.Y + 3 - evbull.Y > 0) && (ev1.Y - evbull.Y - 20 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

Panzer[j].OnExisting(this, ev);

Count += 10;

}

break;

}

case 1:

{

if ((evbull.Exist == true) && (ev1.X + 5 - evbull.X > 0) && (ev1.X - evbull.X - 31 < 0) && (ev1.Y + 3 - evbull.Y > 0) && (ev1.Y - evbull.Y - 20 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

Panzer[j].OnExisting(this, ev);

Count += 10;

}

break;

}

case 2:

{

if ((evbull.Exist == true) && (ev1.X + 5 - evbull.X > 0) && (ev1.X - evbull.X - 21 < 0) && (ev1.Y + 3 - evbull.Y > 0) && (ev1.Y - evbull.Y - 31 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

Panzer[j].OnExisting(this, ev);

Count += 10;

}

break;

}

case 3:

{

if ((evbull.Exist == true) && (ev1.X + 5 - evbull.X > 0) && (ev1.X - evbull.X - 21 < 0) && (ev1.Y + 3 - evbull.Y > 0) && (ev1.Y - evbull.Y - 31 < 0))

{

Permission = 0;

EventArgs ev = new EventArgs();

Panzer[j].OnExisting(this, ev);

Count += 10;

}

break;

}

}

}

}

}

- 30 -