From bcda4554e390dc2f28a27ed0e5ddd48f81daf9fc Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Mon, 11 Sep 2023 13:55:13 +0400 Subject: [PATCH 1/8] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81-=D1=81=D1=83=D1=89?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D1=88=D1=82=D1=83=D1=80=D0=BC?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D0=BA=D0=B0=20=D0=B8=20=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=B8=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=BD=D0=B0=D1=8F=20=D1=84=D0=BE?= =?UTF-8?q?=D1=80=D0=BC=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectStormtrooper/EntityStormtrooper.cs | 59 +++++++++++++++++++ ...signer.cs => FormStormtrooper.Designer.cs} | 10 ++-- .../{Form1.cs => FormStormtrooper.cs} | 4 +- .../{Form1.resx => FormStormtrooper.resx} | 52 ++++++++-------- .../ProjectStormtrooper/Program.cs | 2 +- 5 files changed, 93 insertions(+), 34 deletions(-) create mode 100644 ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs rename ProjectStormtrooper/ProjectStormtrooper/{Form1.Designer.cs => FormStormtrooper.Designer.cs} (78%) rename ProjectStormtrooper/ProjectStormtrooper/{Form1.cs => FormStormtrooper.cs} (54%) rename ProjectStormtrooper/ProjectStormtrooper/{Form1.resx => FormStormtrooper.resx} (93%) diff --git a/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs new file mode 100644 index 0000000..db8b03c --- /dev/null +++ b/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectStormtrooper +{ + internal class EntityStormtrooper + { + /// + /// Скорость + /// + public int Speed { get; private set; } + /// + /// Вес + /// + public double Weight { get; private set; } + /// + /// Основной цвет + /// + public Color BodyColor { get; private set; } + /// + /// Дополнительный цвет (для опциональных элементов) + /// + public Color AdditionalColor { get; private set; } + /// + /// Признак (опция) наличия ракет + /// + public bool Rockets { get; private set; } + /// + /// Признак (опция) наличия бомб + /// + public bool Bombs { get; private set; } + /// + /// Шаг перемещения + /// + public double Step => (double)Speed * 100 / Weight; + /// + /// Инициализация полей объекта-класса штурмовика + /// + /// Скорость + /// Вес + /// Основной цвет + /// Дополнительный цвет + /// Признак наличия ракет + /// Признак наличия бомб + public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool rockets, bool bombs) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + AdditionalColor = additionalColor; + Rockets = rockets; + Bombs = bombs; + } + } +} diff --git a/ProjectStormtrooper/ProjectStormtrooper/Form1.Designer.cs b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.Designer.cs similarity index 78% rename from ProjectStormtrooper/ProjectStormtrooper/Form1.Designer.cs rename to ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.Designer.cs index 68d6185..3f4e1cb 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/Form1.Designer.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.Designer.cs @@ -1,6 +1,6 @@ namespace ProjectStormtrooper { - partial class Form1 + partial class FormStormtrooper { /// /// Required designer variable. @@ -28,10 +28,10 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; + components = new System.ComponentModel.Container(); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Text = "Form1"; } #endregion diff --git a/ProjectStormtrooper/ProjectStormtrooper/Form1.cs b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.cs similarity index 54% rename from ProjectStormtrooper/ProjectStormtrooper/Form1.cs rename to ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.cs index 638b855..88ddd10 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/Form1.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.cs @@ -1,8 +1,8 @@ namespace ProjectStormtrooper { - public partial class Form1 : Form + public partial class FormStormtrooper : Form { - public Form1() + public FormStormtrooper() { InitializeComponent(); } diff --git a/ProjectStormtrooper/ProjectStormtrooper/Form1.resx b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.resx similarity index 93% rename from ProjectStormtrooper/ProjectStormtrooper/Form1.resx rename to ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.resx index 1af7de1..a395bff 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/Form1.resx +++ b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.resx @@ -1,24 +1,24 @@  - diff --git a/ProjectStormtrooper/ProjectStormtrooper/Program.cs b/ProjectStormtrooper/ProjectStormtrooper/Program.cs index 763f0aa..3db6e41 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/Program.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/Program.cs @@ -11,7 +11,7 @@ namespace ProjectStormtrooper // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + Application.Run(new FormStormtrooper()); } } } \ No newline at end of file -- 2.25.1 From efcd700b37408ee1713a38a64729de63f18c1721 Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Mon, 11 Sep 2023 13:59:05 +0400 Subject: [PATCH 2/8] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BF=D0=B5=D1=80=D0=B5=D1=87=D0=B8=D1=81=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B0=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC?= =?UTF-8?q?=D0=B5=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8=20=D0=B8=D1=81?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BC=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D1=84=D0=B8=D0=BA=D0=B0=D1=82=D0=BE=D1=80=D1=8B=20?= =?UTF-8?q?=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF=D0=B0=20=D0=BD=D0=B0=20pub?= =?UTF-8?q?lic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectStormtrooper/DirectionType.cs | 31 +++++++++++++++++++ .../ProjectStormtrooper/EntityStormtrooper.cs | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 ProjectStormtrooper/ProjectStormtrooper/DirectionType.cs diff --git a/ProjectStormtrooper/ProjectStormtrooper/DirectionType.cs b/ProjectStormtrooper/ProjectStormtrooper/DirectionType.cs new file mode 100644 index 0000000..5c55010 --- /dev/null +++ b/ProjectStormtrooper/ProjectStormtrooper/DirectionType.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectStormtrooper +{ + /// + /// Направление перемещения + /// + public enum DirectionType + { + /// + /// Вверх + /// + Up = 1, + /// + /// Вниз + /// + Down = 2, + /// + /// Влево + /// + Left = 3, + /// + /// Вправо + /// + Right = 4 + } +} diff --git a/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs index db8b03c..735349b 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace ProjectStormtrooper { - internal class EntityStormtrooper + public class EntityStormtrooper { /// /// Скорость -- 2.25.1 From 6aa4044f9e5e7a5cc9a798a573415227273319a3 Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Mon, 11 Sep 2023 14:31:36 +0400 Subject: [PATCH 3/8] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D1=80=D0=B8=D1=81=D0=BE=D0=B2=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D0=B0-=D1=81=D1=83=D1=89?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D0=B8,=20=D0=BD=D0=B5=D0=BE=D0=B1?= =?UTF-8?q?=D1=85=D0=BE=D0=B4=D0=B8=D0=BC=D0=BE=20=D1=80=D0=B5=D0=B0=D0=BB?= =?UTF-8?q?=D0=B8=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=B8=20=D0=BC=D0=B5=D1=82?= =?UTF-8?q?=D0=BE=D0=B4=20=D0=BF=D1=80=D0=BE=D1=80=D0=B8=D1=81=D0=BE=D0=B2?= =?UTF-8?q?=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DrawingStormTrooper.cs | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs diff --git a/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs new file mode 100644 index 0000000..080b29d --- /dev/null +++ b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectStormtrooper +{ + /// + /// Класс отвечающий за прорисовку и перемещение объекта-сущности + /// + public class DrawingStormtrooper + { + /// + /// Класс-сущность + /// + public EntityStormtrooper? EntityStormtrooper { get; private set; } + /// + /// Ширина окна + /// + private int _pictureWidth; + /// + /// Высота окна + /// + private int _pictureHeight; + /// + /// Левая координата начала прорисовки + /// + private int _startPosX; + /// + /// Верхняя координата начала прорисовки + /// + private int _startPosY; + /// + /// Ширина прорисовки + /// + private readonly int _stormtrooperWidth = 110; + /// + /// Высота прорисовки + /// + private readonly int _stormtrooperHeight = 60; + /// + /// Инициализация свойств + /// + /// Скорость + /// Вес + /// Основной цвет + /// Дополнительный цвет + /// Признак наличия ракет + /// Признак наличия бомб + /// Ширина картинки + /// Высота картинки + /// true - если объект успешно создан, false - проверка не пройдена, + /// т.к. нельзя создать объект в этих размерах + public bool Init(int speed, double weight, Color bodyColor, + Color additionalColor, bool rockets, bool bombs, + int width, int height) + { + // TODO: продумать проверки + _pictureWidth = width; + _pictureHeight = height; + EntityStormtrooper = new EntityStormtrooper(); + EntityStormtrooper.Init(speed, weight, bodyColor, additionalColor, rockets, bombs); + return true; + } + /// + /// Установка позиции + /// + /// Координата X + /// Координата Y + public void SetPosition(int x, int y) + { + // TODO: изменение X и Y + _startPosX = x; + _startPosY = y; + } + /// + /// Перемещение объекта + /// + /// Направление перемещения + public void MoveTransport(DirectionType direction) + { + if (EntityStormtrooper == null) + { + return; + } + switch (direction) + { + // Вверх + case DirectionType.Up: + if (_startPosY - EntityStormtrooper.Step > 0) + { + _startPosY -= (int)EntityStormtrooper.Step; + } + break; + // Вниз + case DirectionType.Down: + // TODO: Продумать логику + break; + // Влево + case DirectionType.Left: + if (_startPosX - EntityStormtrooper.Step > 0) + { + _startPosX -= (int)EntityStormtrooper.Step; + } + break; + // Вправо + case DirectionType.Right: + // TODO: Продумать логику + break; + } + } + /// + /// Прорисовка объекта + /// + /// + public void DrawTransport(Graphics g) + { + if (EntityStormtrooper == null) + { + return; + } + // TODO: прорисовка объекта + Brush brush = new SolidBrush(Color.Black); + g.FillRectangle(brush, _startPosX, _startPosY, _stormtrooperWidth, _stormtrooperHeight); + } + } +} -- 2.25.1 From 6f727fae328603f27dd4152a352f8b4aecd986a1 Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Mon, 11 Sep 2023 16:29:39 +0400 Subject: [PATCH 4/8] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=8D=D0=BB=D0=B5=D0=BC=D0=B5=D0=BD=D1=82=D1=8B?= =?UTF-8?q?=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B=20=D0=B8=20=D1=80=D0=B5=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D0=B0=20=D0=BD=D0=B5?= =?UTF-8?q?=D0=B4=D0=BE=D1=81=D1=82=D0=B0=D1=8E=D1=89=D0=B0=D1=8F=20=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=B8=D0=BA=D0=B0=20=D1=81=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=BA=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DrawingStormTrooper.cs | 33 ++++- .../ProjectStormtrooper/EntityStormtrooper.cs | 2 +- .../FormStormtrooper.Designer.cs | 104 +++++++++++++- .../ProjectStormtrooper/FormStormtrooper.cs | 75 ++++++++++ .../ProjectStormtrooper.csproj | 15 ++ .../Properties/Resources.Designer.cs | 103 ++++++++++++++ .../Properties/Resources.resx | 133 ++++++++++++++++++ .../Resources/arrowDOWN.png | Bin 0 -> 1492 bytes .../Resources/arrowLEFT.png | Bin 0 -> 1458 bytes .../Resources/arrowRIGHT.png | Bin 0 -> 1429 bytes .../ProjectStormtrooper/Resources/arrowUP.png | Bin 0 -> 1530 bytes 11 files changed, 459 insertions(+), 6 deletions(-) create mode 100644 ProjectStormtrooper/ProjectStormtrooper/Properties/Resources.Designer.cs create mode 100644 ProjectStormtrooper/ProjectStormtrooper/Properties/Resources.resx create mode 100644 ProjectStormtrooper/ProjectStormtrooper/Resources/arrowDOWN.png create mode 100644 ProjectStormtrooper/ProjectStormtrooper/Resources/arrowLEFT.png create mode 100644 ProjectStormtrooper/ProjectStormtrooper/Resources/arrowRIGHT.png create mode 100644 ProjectStormtrooper/ProjectStormtrooper/Resources/arrowUP.png diff --git a/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs index 080b29d..8a3a2ad 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs @@ -57,6 +57,10 @@ namespace ProjectStormtrooper int width, int height) { // TODO: продумать проверки + if (width < _stormtrooperWidth && height < _stormtrooperHeight) + { + return false; + } _pictureWidth = width; _pictureHeight = height; EntityStormtrooper = new EntityStormtrooper(); @@ -71,7 +75,24 @@ namespace ProjectStormtrooper public void SetPosition(int x, int y) { // TODO: изменение X и Y + if (x < 0) + { + x = 0; + } + else if (x > _pictureWidth - _stormtrooperWidth) + { + x = _pictureWidth - _stormtrooperWidth; + } _startPosX = x; + + if (y < 0) + { + y = 0; + } + else if (y > _pictureHeight - _stormtrooperHeight) + { + y = _pictureHeight - _stormtrooperHeight; + } _startPosY = y; } /// @@ -88,7 +109,7 @@ namespace ProjectStormtrooper { // Вверх case DirectionType.Up: - if (_startPosY - EntityStormtrooper.Step > 0) + if (_startPosY - EntityStormtrooper.Step >= 0) { _startPosY -= (int)EntityStormtrooper.Step; } @@ -96,10 +117,14 @@ namespace ProjectStormtrooper // Вниз case DirectionType.Down: // TODO: Продумать логику + if (_startPosY + _stormtrooperHeight + EntityStormtrooper.Step <= _pictureHeight) + { + _startPosY += (int)EntityStormtrooper.Step; + } break; // Влево case DirectionType.Left: - if (_startPosX - EntityStormtrooper.Step > 0) + if (_startPosX - EntityStormtrooper.Step >= 0) { _startPosX -= (int)EntityStormtrooper.Step; } @@ -107,6 +132,10 @@ namespace ProjectStormtrooper // Вправо case DirectionType.Right: // TODO: Продумать логику + if (_startPosX + _stormtrooperWidth + EntityStormtrooper.Step <= _pictureWidth) + { + _startPosX += (int)EntityStormtrooper.Step; + } break; } } diff --git a/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs index 735349b..3f963b2 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs @@ -36,7 +36,7 @@ namespace ProjectStormtrooper /// /// Шаг перемещения /// - public double Step => (double)Speed * 100 / Weight; + public double Step => (double)Speed * 500 / Weight; /// /// Инициализация полей объекта-класса штурмовика /// diff --git a/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.Designer.cs b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.Designer.cs index 3f4e1cb..9b11491 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.Designer.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.Designer.cs @@ -28,12 +28,110 @@ /// private void InitializeComponent() { - components = new System.ComponentModel.Container(); + pictureBoxStormtrooper = new PictureBox(); + buttonCreate = new Button(); + buttonUp = new Button(); + buttonDown = new Button(); + buttonLeft = new Button(); + buttonRight = new Button(); + ((System.ComponentModel.ISupportInitialize)pictureBoxStormtrooper).BeginInit(); + SuspendLayout(); + // + // pictureBoxStormtrooper + // + pictureBoxStormtrooper.Dock = DockStyle.Fill; + pictureBoxStormtrooper.Location = new Point(0, 0); + pictureBoxStormtrooper.Name = "pictureBoxStormtrooper"; + pictureBoxStormtrooper.Size = new Size(882, 453); + pictureBoxStormtrooper.SizeMode = PictureBoxSizeMode.AutoSize; + pictureBoxStormtrooper.TabIndex = 0; + pictureBoxStormtrooper.TabStop = false; + // + // buttonCreate + // + buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonCreate.Location = new Point(12, 412); + buttonCreate.Name = "buttonCreate"; + buttonCreate.Size = new Size(94, 29); + buttonCreate.TabIndex = 1; + buttonCreate.Text = "Создать"; + buttonCreate.UseVisualStyleBackColor = true; + buttonCreate.Click += buttonCreate_Click; + // + // buttonUp + // + buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonUp.BackgroundImage = Properties.Resources.arrowUP; + buttonUp.BackgroundImageLayout = ImageLayout.Zoom; + buttonUp.Location = new Point(804, 375); + buttonUp.Name = "buttonUp"; + buttonUp.Size = new Size(30, 30); + buttonUp.TabIndex = 2; + buttonUp.UseVisualStyleBackColor = true; + buttonUp.Click += buttonMove_Click; + // + // buttonDown + // + buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonDown.BackgroundImage = Properties.Resources.arrowDOWN; + buttonDown.BackgroundImageLayout = ImageLayout.Zoom; + buttonDown.Location = new Point(804, 411); + buttonDown.Name = "buttonDown"; + buttonDown.Size = new Size(30, 30); + buttonDown.TabIndex = 3; + buttonDown.UseVisualStyleBackColor = true; + buttonDown.Click += buttonMove_Click; + // + // buttonLeft + // + buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonLeft.BackgroundImage = Properties.Resources.arrowLEFT; + buttonLeft.BackgroundImageLayout = ImageLayout.Zoom; + buttonLeft.Location = new Point(768, 411); + buttonLeft.Name = "buttonLeft"; + buttonLeft.Size = new Size(30, 30); + buttonLeft.TabIndex = 4; + buttonLeft.UseVisualStyleBackColor = true; + buttonLeft.Click += buttonMove_Click; + // + // buttonRight + // + buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonRight.BackgroundImage = Properties.Resources.arrowRIGHT; + buttonRight.BackgroundImageLayout = ImageLayout.Zoom; + buttonRight.Location = new Point(840, 411); + buttonRight.Name = "buttonRight"; + buttonRight.Size = new Size(30, 30); + buttonRight.TabIndex = 5; + buttonRight.UseVisualStyleBackColor = true; + buttonRight.Click += buttonMove_Click; + // + // FormStormtrooper + // + AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); - Text = "Form1"; + ClientSize = new Size(882, 453); + Controls.Add(buttonRight); + Controls.Add(buttonLeft); + Controls.Add(buttonDown); + Controls.Add(buttonUp); + Controls.Add(buttonCreate); + Controls.Add(pictureBoxStormtrooper); + Name = "FormStormtrooper"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Штурмовик"; + ((System.ComponentModel.ISupportInitialize)pictureBoxStormtrooper).EndInit(); + ResumeLayout(false); + PerformLayout(); } #endregion + + private PictureBox pictureBoxStormtrooper; + private Button buttonCreate; + private Button buttonUp; + private Button buttonDown; + private Button buttonLeft; + private Button buttonRight; } } \ No newline at end of file diff --git a/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.cs index 88ddd10..d8b7972 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.cs @@ -1,10 +1,85 @@ namespace ProjectStormtrooper { + /// + /// "" + /// public partial class FormStormtrooper : Form { + /// + /// - + /// + private DrawingStormtrooper? _drawingStormtrooper; + /// + /// + /// public FormStormtrooper() { InitializeComponent(); } + /// + /// + /// + private void Draw() + { + if (_drawingStormtrooper == null) + { + return; + } + Bitmap bmp = new(pictureBoxStormtrooper.Width, pictureBoxStormtrooper.Height); + Graphics g = Graphics.FromImage(bmp); + _drawingStormtrooper.DrawTransport(g); + pictureBoxStormtrooper.Image = bmp; + } + /// + /// "" + /// + /// + /// + private void buttonCreate_Click(object sender, EventArgs e) + { + Random random = new(); + _drawingStormtrooper = new DrawingStormtrooper(); + _drawingStormtrooper.Init( + random.Next(100, 300), + random.Next(1000, 3000), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), + Convert.ToBoolean(random.Next(0, 2)), + Convert.ToBoolean(random.Next(0, 2)), + pictureBoxStormtrooper.Width, + pictureBoxStormtrooper.Height + ); + _drawingStormtrooper.SetPosition(random.Next(10, 100), random.Next(10, 100)); + Draw(); + } + /// + /// + /// + /// + /// + private void buttonMove_Click(object sender, EventArgs e) + { + if (_drawingStormtrooper == null) + { + return; + } + string buttonName = ((Button)sender)?.Name ?? string.Empty; + switch (buttonName) + { + case "buttonUp": + _drawingStormtrooper.MoveTransport(DirectionType.Up); + break; + case "buttonDown": + _drawingStormtrooper.MoveTransport(DirectionType.Down); + break; + case "buttonLeft": + _drawingStormtrooper.MoveTransport(DirectionType.Left); + break; + case "buttonRight": + _drawingStormtrooper.MoveTransport(DirectionType.Right); + break; + } + Draw(); + } } } \ No newline at end of file diff --git a/ProjectStormtrooper/ProjectStormtrooper/ProjectStormtrooper.csproj b/ProjectStormtrooper/ProjectStormtrooper/ProjectStormtrooper.csproj index b57c89e..13ee123 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/ProjectStormtrooper.csproj +++ b/ProjectStormtrooper/ProjectStormtrooper/ProjectStormtrooper.csproj @@ -8,4 +8,19 @@ enable + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/ProjectStormtrooper/ProjectStormtrooper/Properties/Resources.Designer.cs b/ProjectStormtrooper/ProjectStormtrooper/Properties/Resources.Designer.cs new file mode 100644 index 0000000..945bb3d --- /dev/null +++ b/ProjectStormtrooper/ProjectStormtrooper/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectStormtrooper.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectStormtrooper.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrowDOWN { + get { + object obj = ResourceManager.GetObject("arrowDOWN", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrowLEFT { + get { + object obj = ResourceManager.GetObject("arrowLEFT", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrowRIGHT { + get { + object obj = ResourceManager.GetObject("arrowRIGHT", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrowUP { + get { + object obj = ResourceManager.GetObject("arrowUP", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ProjectStormtrooper/ProjectStormtrooper/Properties/Resources.resx b/ProjectStormtrooper/ProjectStormtrooper/Properties/Resources.resx new file mode 100644 index 0000000..d5898a2 --- /dev/null +++ b/ProjectStormtrooper/ProjectStormtrooper/Properties/Resources.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\arrowLEFT.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\arrowDOWN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\arrowRIGHT.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\arrowUP.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProjectStormtrooper/ProjectStormtrooper/Resources/arrowDOWN.png b/ProjectStormtrooper/ProjectStormtrooper/Resources/arrowDOWN.png new file mode 100644 index 0000000000000000000000000000000000000000..7ef7c0835c433e845d8a36c12c5c97060c337ca2 GIT binary patch literal 1492 zcmV;_1uOcAP)NklBIp_O_Gr1lc2kD?Y*A4Jo;G>M^*Hgn6|&fd$1GdY=S5@(VW!JmQ2IeYJQzFBMU zwf5N|&J&bmQM8HX#e=umiOI2_D1n0ZmH8=q9KulIPJOS87d ztg9^o0m|TTthm?g_9_II9G^%|Ogev$CE|Og?oQdM0zjKgZ(r@Bme9=Fn(D6IYulO^ z`Hf{rhC;!S%Tv9_k`t3*B|Glk%4ACGblry0jg8k|*lq`dyehJT!9SZ?MmIK|uG`>Z z2AEFfnhujsrfroh&x0l14=0N7-D0r(o~SDywzPD}&4>~#@ zbaW;zj+AdrFP|p#@-8Qvg?{?kfBZAgGh53sSgwcSCr=4okfD*G30=fboGQ~`xgL^N zN6BZ-)ea_)_K<<#Gax7pqyV#AgXNAVuK|rf1a>^Md_cqtbSo~OK|;78E6qd1a5pW> z;voS+V1{BUF=XuSJ2E_kl3e69NEaXi0Ht7-GN~zJFEs~L947VqAF;lEE#UX=+@a;| z*T}0w*GLcmma1ULj-TN)OI(_O}5G}F&*)0l-u$#cWjseXNPR>>oe z0YigEV31T~U!-*S+FNt(a3m6WyG!1>;obnxeK7Cn zL+erw(NA$@&aK@RunE>KaQ`r2Eqqeq|^NB>!vY%8QBk`gJ2l!UFQqRJXLp*Jq>n_M7XY$bTwS|BLebC3lQh?z+# z=!&(uTBaD%WwJRX$yZ^WJfSyiUf6Oe9!fK{Gy{kpe3t=YX35YMgp*~!%#aGUf-N~I z$x~sS>|2xu*}ll|(9#YG(o8))EERO+SK`N@KT1un}s>JPwr?nZ(k$1WwD04r=im9^78Yq#bbRYnpwiZ?#*|#5r^eST} z%kmEnEPYKaClCN{dn=g3`}R8vh5T0F%ohvfn-vEF;O%HLo_aEN_FDkH=UcQQm0|UO z0BGy$s`kEKz8yybKv*gO$?=KhGFpxVfa}RP0QcN)l_f)=Tp$2ri8z4!Uw^myK*5pA z0ItNMSwMrqX#i8b$8vaAS~3)x>OBTvC_Iw|G#n0&CF046$=k1Wts0XIg>JmKBRMfS zmWaCt*7Gk3zr|zET7H`RduI5&=J)#=OH8#(M41^r|JR_@J&ZB5G)mm-M0uZ1X9B!R-*~ln6U)@Y-ht8fQ)WDomd;!E?u^=2VTtp#>#oBzvzDQX&Zf1M>WGc0)wZ+%e_{c!DHD)}amM*wBWqbNkdk?th`o;dL;Xw~f znAv6JNbl~Q_-Mai7R(B>V9s`&^%iOg9MXIGG9MpQR0Tu;h#AZx>T#Tw3uN^6XAT{v zpbv_Yzjsh56liT(0U)D)Aal5l0zRk;6v{ai3Wb08QFt93-hqt%flS*G1bk2hxj+h0 zC=~kcdv*PK&tW|R8T|v9BS+y^NfS^7R6&9$91eZeF6tY+#dMbsg+Rpf6fLCb8^|1K zgWpG*3cpG|0aZ{m9QyoQv98`5OY?A+h~9x~_tU9@I7ROG_ow$~^U1~Zr;0mg{*f%#xJT9JVA|iuxE- zC3icM3|q40z_ejHY}znwHr%5Vc)wUu15^l9#3Z#T7P-)s+Sv><>vFIy$#PgB-wT_x zO)o97ZAHX1&pcG@c~fm_jGXJFiV$oG+kxf4bYR$%C%-hWUM`mgfQOk{jWvdUK10C@ zHXWEYyWOE%lV6`OuUsk*iRJ;C_p!H-sc}R2%xUshxG3)I$GSE7#c}h}Z=P{HIy8f+ zgZx1@Y}PHf({a|!eDySqxDgy|4pR^!!i?bGIP4}2N+-3|8dJbFGB42IX5bit; zE$H5=kh99n96RCMkFNj_05#Sa>FOjcD0SB)le3n5FsA=>c4dIz&IK2KK`100mJUnF zlHsIMD+UBWZHh&^&pAZyhog~TYm3KFO9BMI*VOpr?^iRYI{{Q|d)?b(>nxzOBLSFR zlM#Trwl;e76VI2sRZn-ByTxb56P~-j9670!8Bd@fheiw?K=R7fEwu^oAJc$9WBeo(i`Usia}G0gSk<7`bZ^L z5F>`ZXY`)CNnPyK!q#x*^TAamg3Zv}o&1uzmdy;N$7jA;_+O>;FDaPbOF=-Tp#T5? M07*qoM6N<$f_|;I`~Uy| literal 0 HcmV?d00001 diff --git a/ProjectStormtrooper/ProjectStormtrooper/Resources/arrowRIGHT.png b/ProjectStormtrooper/ProjectStormtrooper/Resources/arrowRIGHT.png new file mode 100644 index 0000000000000000000000000000000000000000..563b1b9c8532ddbccba60febab7fa883e7c97334 GIT binary patch literal 1429 zcmV;G1#0?3_-=0BUAO$kWI#v4&m^|rM4LWs11RIOStHPJ}%2U6QwT1#!Au@a$55$sh{ zVyn;=ZA}rZ2)*j1w;I>q3fXNC4B44Uc6TyozFy2`v%6V$H?tah(U)bIzjMB4-gC~J zGv5OLtGZb6K~FT+8*O>Th%C1}EhprS%$9zJ@z$O40-hf|iXW4nU2! zudqFVB-2#m?Eu!Pi%c>AwId#)y7`+Ea~FRF5ZT)=ukHxPq;|yJWGX805}wdf zvH@g9&$V71S2nH>S5=vK?OQ4-Gdjl7mP8c%(mQr}H*dX2Ajvd21LurOj7toTW9@v$ zyE*Z~fb@L>d{rwm6lSQ*P`R#|SS9yxXth6-JQuE0>3uE5RM{d>KM z+b;kJfY#d^IX=t`b-^bExvG)vy zX5y%{kf>kk=GU7(`Hblb3)(KvG*_ojY>5{^lZCY?VCvf3bmVA&!c-Zm%v6aobN22% zA^Lcu4&|9PbvGUU7@7=Kf+9hdAaj~?tX=)J-Ua1e$V*KtR_@yM?Dsz~O@b;jEqHnv zssvSLiUgU1GZ5hW@O-Aq2p0EmJwiTsXFAR?b2DBn^!k30cE!6gugsH7BNytSo%pr<~X*4<@(_pSWe ztMCZ{f$u~3wGjswoQTpW5^Y7MPztb z+ftimX@`+3o~={fojcBZ2gz~rU3j6hM~1(who+*!JLKI?*!$ll#{mE$_yo_-w^Ue~ z@IYcRY408&$63tB_&y109{H*fn(#o`(J}w=ll)|YyhD+%M{13!=LRIwmM^H#{RoIw zec#ltkZWpVa6mBTGbR`lj5VJ=sqfg@Sr=OGnU9r=NT-Hsd9v&E4F(zSI4-X8v$y6ejElXHS0REbDdd(J= z`e)|KRmn7s4KF`en(0fIA00lDnMl~aI6O5uExh8Z`FVAnst>PfFQog7^_>-ye8D#p zD_U1A&EyA*nTiv(JDDsDplXTpf_kE{zF2F`eEwqC5)xMDsv(ifo=-oi@z+9`)~R}N j-tSq-7XDI8{_FY|wU>1BYn}kO00000NkvXXu0mjf8*sJ& literal 0 HcmV?d00001 diff --git a/ProjectStormtrooper/ProjectStormtrooper/Resources/arrowUP.png b/ProjectStormtrooper/ProjectStormtrooper/Resources/arrowUP.png new file mode 100644 index 0000000000000000000000000000000000000000..c5a432c4b89cffe052e56bc0c371e7bc1ffc66f7 GIT binary patch literal 1530 zcmV1uSGdsI2+ik-YY0-#9v5=VdMlV&8TKpmW6yd^3Tk4G=sUaXK)B=f#(HI~$ z0f`X-qZcYgyf!g-X}q8@=`KxdOynor*p%I_+wRWH@nU9nXQ$m?cA+G^$z;#&oH^h7 zp6{IRoH^gZV?4%vL6lSJdi%!bftEUR@nf!QCi-WoN(BX6Z{N5VH~@53%fQ>XthN!D z1WtF&M87Fz1IYIFB|OCSwpR4DZAGn!EJInaSER?JEaCg~t=pt;-|_x53H1BDlGltw z{x_gSZ);`E@P3-RH={-(#jVv5vlCajJATF$GY7on72y|f9q4T6*ueVlEjAgm74R}ZbNA*4$ErfC?%nPdvjIl&S6Yd^?}amr+<>!Gz)FWFoVNgI z^)h7MyhZBrPXILR+JXAS+Pc`OivVLP%G~ZgWIO>t>eM(*CqE&yySL`HYA(Q-iV@%Q z4q|>Dp*kZ}O6Ct80U-#zwX>%7YAV2p#)$XzBhx8FLjZ)cPD;SCNFEtQD1u<`j+)u5 znE)epgGB#6NT(2?04Pc>L`V>p1k)lpItD@z+_}AId*z}g0*u%V5`+7Y=@f(l2u*PW zxE_#TNu*(cVUj#H1_FXR?q5W{fGYO9Hu)jsVhRz`KvO|eKvfXV5R#4nVOU@&$c#er z*m0n85yHnYPk^XULAK`?Q;47jx&{H&_JEr6fRKP`_rA;sgs?3o$BtDcqKJSB$VX!& z`t4!kk{7xLx|$QAE~>3lR#~SA+dYFhKa!IYdjdGf&jqv#KC@XoQ6yCdwl1od*@|g)&ny=63gCB@*@o zRfIiERQqat|1kP1uiCvI)NJw%I)pTYuA)BGPWYpfh~_4Q>OL>B5i4_l=vk`1iGK$aunDpA=y)R04z$G#(g1-`wN0svrXPa3ZAHWz9CFu4^a!@o7X; zQ(hYgfdJwMN61XY3i9ytEZYOguP+sBvhjnX=-peES`i|5c}%NMuP6N3I3gTgw#D+i zU?VG_q5vwf7bl=`bPRpV>-qQHMJsK&(GQ-oc3G}RyfwvM5M{FB_Z6zsuL#&zVYVL$_{y%${+Q+H)I-T)E7``HPtM z;xr5m5ZKgFl)jf|Me9IdQwM=lpO&teHeexx^ep{lEGAu%a zdrLo91?u8~U{5!Zug>z{d3*oVIMh$Dr@J1e>UT01?CGu>X)hkRvr#j*(VK&11eis3 zf-3>3*faocn#n8R8o<3@etqDi%Ej!&Rkt|l7Q6y30Nfovvm(7<#^c-_KjVHq?G~~E zoILDg`t}|EdV63+iExvAPNs6wn=|&$fo;HCDmKmZ)?Q{Ou0C`jvlCaD-rDPCDCdBF z@BQTx-A@8PQ%Ry*X4BVs4T{`tU-i<-?gEMKZCx|be~Jol;iNJLagu+Pz&^L}(-zh4 gcCP^!3jNjKe@5jeYd4kyO#lD@07*qoM6N<$f~*4G%>V!Z literal 0 HcmV?d00001 -- 2.25.1 From ff8673a9fdb8aa4c3e0a3d5a535c5d7af447e200 Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Mon, 11 Sep 2023 18:56:04 +0400 Subject: [PATCH 5/8] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B0=20=D0=BE=D1=82=D1=80=D0=B8=D1=81=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=B8=20=D1=83=D0=B1=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D1=8B=20TODO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DrawingStormTrooper.cs | 186 +++++++++++++++++- .../ProjectStormtrooper/EntityStormtrooper.cs | 2 +- 2 files changed, 179 insertions(+), 9 deletions(-) diff --git a/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs index 8a3a2ad..14a6cce 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs @@ -38,7 +38,7 @@ namespace ProjectStormtrooper /// /// Высота прорисовки /// - private readonly int _stormtrooperHeight = 60; + private readonly int _stormtrooperHeight = 110; /// /// Инициализация свойств /// @@ -56,7 +56,6 @@ namespace ProjectStormtrooper Color additionalColor, bool rockets, bool bombs, int width, int height) { - // TODO: продумать проверки if (width < _stormtrooperWidth && height < _stormtrooperHeight) { return false; @@ -74,7 +73,6 @@ namespace ProjectStormtrooper /// Координата Y public void SetPosition(int x, int y) { - // TODO: изменение X и Y if (x < 0) { x = 0; @@ -116,7 +114,6 @@ namespace ProjectStormtrooper break; // Вниз case DirectionType.Down: - // TODO: Продумать логику if (_startPosY + _stormtrooperHeight + EntityStormtrooper.Step <= _pictureHeight) { _startPosY += (int)EntityStormtrooper.Step; @@ -131,7 +128,6 @@ namespace ProjectStormtrooper break; // Вправо case DirectionType.Right: - // TODO: Продумать логику if (_startPosX + _stormtrooperWidth + EntityStormtrooper.Step <= _pictureWidth) { _startPosX += (int)EntityStormtrooper.Step; @@ -149,9 +145,183 @@ namespace ProjectStormtrooper { return; } - // TODO: прорисовка объекта - Brush brush = new SolidBrush(Color.Black); - g.FillRectangle(brush, _startPosX, _startPosY, _stormtrooperWidth, _stormtrooperHeight); + Pen penBlack = new Pen(Color.Black); + Brush brushBlack = new SolidBrush(Color.Black); + Brush brushBodyColor = new SolidBrush(EntityStormtrooper.BodyColor); + Brush brushAdditionalColor = new SolidBrush(EntityStormtrooper.AdditionalColor); + + + // Ширина фюзеляжа + int bodyWidth = _stormtrooperHeight / 9; + + // Рисуем бомбы + if (EntityStormtrooper.Bombs) + { + Point[] pointsBombTail = { + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyWidth * 3 - 5, + _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3 + bodyWidth / 2), + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyWidth * 3 + 5, + _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3 + bodyWidth / 2 - 5), + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyWidth * 3 + 5, + _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3 + bodyWidth / 2 + 5), + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyWidth * 3 - 5, + _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3 + bodyWidth / 2) + }; + + g.FillPolygon(brushAdditionalColor, pointsBombTail); + g.DrawPolygon(penBlack, pointsBombTail); + + for (int i = 0; i < pointsBombTail.Length; i++) + { + Point p = pointsBombTail[i]; + p.Y = _startPosY + _stormtrooperHeight - (p.Y - _startPosY); + pointsBombTail[i] = p; + } + + g.FillPolygon(brushAdditionalColor, pointsBombTail); + g.DrawPolygon(penBlack, pointsBombTail); + + g.FillEllipse(brushAdditionalColor, + _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8, + _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3, + bodyWidth * 3, + bodyWidth); + g.DrawEllipse(penBlack, + _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8, + _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3, + bodyWidth * 3, + bodyWidth); + + g.FillEllipse(brushAdditionalColor, + _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8, + _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 + _stormtrooperHeight / 3, + bodyWidth * 3, + bodyWidth); + g.DrawEllipse(penBlack, + _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8, + _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 + _stormtrooperHeight / 3, + bodyWidth * 3, + bodyWidth); + } + + // Рисуем ракеты + if (EntityStormtrooper.Rockets) + { + int rocketWidth = bodyWidth * 4; + int rocketHeight = bodyWidth / 2; + + Brush brushRed = new SolidBrush(Color.Red); + + + + Point[] rocketCockPit = { + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 - rocketHeight, + _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight / 2), + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, + _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2), + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, + _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight) + }; + + Point[] rocketTail = { + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 - rocketHeight + rocketWidth - 10, + _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight / 2), + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 + rocketWidth, + _startPosY + _stormtrooperHeight / 2 - bodyWidth * 2 + rocketHeight / 2), + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 + rocketWidth, + _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight + bodyWidth / 2 - rocketHeight / 2) + }; + + g.FillPolygon(brushRed, rocketCockPit); + g.DrawPolygon(penBlack, rocketCockPit); + + g.FillPolygon(brushBlack, rocketTail); + g.DrawPolygon(penBlack, rocketTail); + + for (int i = 0; i < rocketCockPit.Length; i++) + { + Point p = rocketCockPit[i]; + p.Y = _startPosY + _stormtrooperHeight - (p.Y - _startPosY); + rocketCockPit[i] = p; + } + + for (int i = 0; i < rocketTail.Length; i++) + { + Point p = rocketTail[i]; + p.Y = _startPosY + _stormtrooperHeight - (p.Y - _startPosY); + rocketTail[i] = p; + } + + g.FillPolygon(brushRed, rocketCockPit); + g.DrawPolygon(penBlack, rocketCockPit); + + g.FillPolygon(brushBlack, rocketTail); + g.DrawPolygon(penBlack, rocketTail); + + g.FillRectangle(brushAdditionalColor, + _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, + _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2, + rocketWidth, + rocketHeight); + g.DrawRectangle(penBlack, + _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, + _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2, + rocketWidth, + rocketHeight); + + g.FillRectangle(brushAdditionalColor, + _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, + _startPosY + _stormtrooperHeight / 2 + bodyWidth / 2 + bodyWidth / 2, + rocketWidth, + rocketHeight); + g.DrawRectangle(penBlack, + _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, + _startPosY + _stormtrooperHeight / 2 + bodyWidth / 2 + bodyWidth / 2, + rocketWidth, + rocketHeight); + } + + + // Рисуем нос + + Point[] pointsCockPit = { + new Point(_startPosX, _startPosY + _stormtrooperHeight / 2), + new Point(_startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2), + new Point(_startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 + bodyWidth / 2) + }; + + g.FillPolygon(brushBlack, pointsCockPit); + + // Рисуем крылья + + Point[] pointsWings = { + new Point(_startPosX + _stormtrooperWidth / 2, _startPosY), + new Point(_startPosX + _stormtrooperWidth / 2 + _stormtrooperWidth / 15, _startPosY), + new Point(_startPosX + _stormtrooperWidth / 2 + _stormtrooperWidth / 6, _startPosY + _stormtrooperHeight / 2), + new Point(_startPosX + _stormtrooperWidth / 2 + _stormtrooperWidth / 15, _startPosY + _stormtrooperHeight), + new Point(_startPosX + _stormtrooperWidth / 2 , _startPosY + _stormtrooperHeight) + }; + + g.FillPolygon(brushBodyColor, pointsWings); + g.DrawPolygon(penBlack, pointsWings); + + // Рисуем хвостовое оперение + + Point[] pointsTail = { + new Point(_startPosX + _stormtrooperWidth, _startPosY + _stormtrooperHeight / 2 - _stormtrooperHeight / 3), + new Point(_startPosX + _stormtrooperWidth - _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - _stormtrooperHeight / 8), + new Point(_startPosX + _stormtrooperWidth - _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 + _stormtrooperHeight / 8), + new Point(_startPosX + _stormtrooperWidth, _startPosY + _stormtrooperHeight / 2 + _stormtrooperHeight / 3) + + }; + + g.FillPolygon(brushBodyColor, pointsTail); + g.DrawPolygon(penBlack, pointsTail); + + // Рисуем фюзеляж + + g.FillRectangle(brushBodyColor, _startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2, _stormtrooperWidth - _stormtrooperWidth / 8, bodyWidth); + g.DrawRectangle(penBlack, _startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2, _stormtrooperWidth - _stormtrooperWidth / 8, bodyWidth); } } } diff --git a/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs index 3f963b2..cc08601 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/EntityStormtrooper.cs @@ -36,7 +36,7 @@ namespace ProjectStormtrooper /// /// Шаг перемещения /// - public double Step => (double)Speed * 500 / Weight; + public double Step => (double)Speed * 250 / Weight; /// /// Инициализация полей объекта-класса штурмовика /// -- 2.25.1 From 783360560ce90bab09f87df379db72c0bd48977b Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Tue, 12 Sep 2023 12:19:37 +0400 Subject: [PATCH 6/8] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=B2=20=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D0=BE=D0=B4=D0=B5=20=D0=BE=D1=82=D1=80=D0=B8=D1=81=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DrawingStormTrooper.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs index 14a6cce..c8389ed 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs @@ -214,7 +214,7 @@ namespace ProjectStormtrooper - Point[] rocketCockPit = { + Point[] pointsRocketCockPit = { new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 - rocketHeight, _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight / 2), new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, @@ -223,7 +223,7 @@ namespace ProjectStormtrooper _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight) }; - Point[] rocketTail = { + Point[] pointsRocketTail = { new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 - rocketHeight + rocketWidth - 10, _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight / 2), new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 + rocketWidth, @@ -232,31 +232,31 @@ namespace ProjectStormtrooper _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight + bodyWidth / 2 - rocketHeight / 2) }; - g.FillPolygon(brushRed, rocketCockPit); - g.DrawPolygon(penBlack, rocketCockPit); + g.FillPolygon(brushRed, pointsRocketCockPit); + g.DrawPolygon(penBlack, pointsRocketCockPit); - g.FillPolygon(brushBlack, rocketTail); - g.DrawPolygon(penBlack, rocketTail); + g.FillPolygon(brushBlack, pointsRocketTail); + g.DrawPolygon(penBlack, pointsRocketTail); - for (int i = 0; i < rocketCockPit.Length; i++) + for (int i = 0; i < pointsRocketCockPit.Length; i++) { - Point p = rocketCockPit[i]; + Point p = pointsRocketCockPit[i]; p.Y = _startPosY + _stormtrooperHeight - (p.Y - _startPosY); - rocketCockPit[i] = p; + pointsRocketCockPit[i] = p; } - for (int i = 0; i < rocketTail.Length; i++) + for (int i = 0; i < pointsRocketTail.Length; i++) { - Point p = rocketTail[i]; + Point p = pointsRocketTail[i]; p.Y = _startPosY + _stormtrooperHeight - (p.Y - _startPosY); - rocketTail[i] = p; + pointsRocketTail[i] = p; } - g.FillPolygon(brushRed, rocketCockPit); - g.DrawPolygon(penBlack, rocketCockPit); + g.FillPolygon(brushRed, pointsRocketCockPit); + g.DrawPolygon(penBlack, pointsRocketCockPit); - g.FillPolygon(brushBlack, rocketTail); - g.DrawPolygon(penBlack, rocketTail); + g.FillPolygon(brushBlack, pointsRocketTail); + g.DrawPolygon(penBlack, pointsRocketTail); g.FillRectangle(brushAdditionalColor, _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, -- 2.25.1 From 5f9528e536571a23ca932e4df173f516f5d24ccc Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Wed, 13 Sep 2023 09:53:26 +0400 Subject: [PATCH 7/8] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=20=D1=84=D0=B0=D0=B9=D0=BB=20?= =?UTF-8?q?=D0=B8=20=D1=83=D0=B1=D1=80=D0=B0=D0=BD=D1=8B=20=D0=BB=D0=B8?= =?UTF-8?q?=D1=88=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=83=D1=81=D1=82=D1=8B=D0=B5?= =?UTF-8?q?=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectStormtrooper/DrawingStormTrooper.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs index c8389ed..2b97e09 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs @@ -150,7 +150,6 @@ namespace ProjectStormtrooper Brush brushBodyColor = new SolidBrush(EntityStormtrooper.BodyColor); Brush brushAdditionalColor = new SolidBrush(EntityStormtrooper.AdditionalColor); - // Ширина фюзеляжа int bodyWidth = _stormtrooperHeight / 9; @@ -210,9 +209,7 @@ namespace ProjectStormtrooper int rocketWidth = bodyWidth * 4; int rocketHeight = bodyWidth / 2; - Brush brushRed = new SolidBrush(Color.Red); - - + Brush brushRed = new SolidBrush(Color.Red); Point[] pointsRocketCockPit = { new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 - rocketHeight, @@ -281,7 +278,6 @@ namespace ProjectStormtrooper rocketHeight); } - // Рисуем нос Point[] pointsCockPit = { -- 2.25.1 From 1936a98d43655d0ce4d3b6aeeb24c09ddd9cace7 Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Wed, 13 Sep 2023 10:56:22 +0400 Subject: [PATCH 8/8] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B2=20=D0=BD=D0=B0=D0=B7=D0=B2=D0=B0=D0=BD=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DrawingStormTrooper.cs | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs index 2b97e09..76ef983 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/DrawingStormTrooper.cs @@ -150,21 +150,21 @@ namespace ProjectStormtrooper Brush brushBodyColor = new SolidBrush(EntityStormtrooper.BodyColor); Brush brushAdditionalColor = new SolidBrush(EntityStormtrooper.AdditionalColor); - // Ширина фюзеляжа - int bodyWidth = _stormtrooperHeight / 9; + // Высота фюзеляжа + int bodyHeight = _stormtrooperHeight / 9; // Рисуем бомбы if (EntityStormtrooper.Bombs) { Point[] pointsBombTail = { - new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyWidth * 3 - 5, - _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3 + bodyWidth / 2), - new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyWidth * 3 + 5, - _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3 + bodyWidth / 2 - 5), - new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyWidth * 3 + 5, - _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3 + bodyWidth / 2 + 5), - new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyWidth * 3 - 5, - _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3 + bodyWidth / 2) + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyHeight * 3 - 5, + _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3 + bodyHeight / 2), + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyHeight * 3 + 5, + _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3 + bodyHeight / 2 - 5), + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyHeight * 3 + 5, + _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3 + bodyHeight / 2 + 5), + new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyHeight * 3 - 5, + _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3 + bodyHeight / 2) }; g.FillPolygon(brushAdditionalColor, pointsBombTail); @@ -182,51 +182,51 @@ namespace ProjectStormtrooper g.FillEllipse(brushAdditionalColor, _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8, - _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3, - bodyWidth * 3, - bodyWidth); + _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3, + bodyHeight * 3, + bodyHeight); g.DrawEllipse(penBlack, _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8, - _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 - _stormtrooperHeight / 3, - bodyWidth * 3, - bodyWidth); + _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3, + bodyHeight * 3, + bodyHeight); g.FillEllipse(brushAdditionalColor, _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8, - _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 + _stormtrooperHeight / 3, - bodyWidth * 3, - bodyWidth); + _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 + _stormtrooperHeight / 3, + bodyHeight * 3, + bodyHeight); g.DrawEllipse(penBlack, _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8, - _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2 + _stormtrooperHeight / 3, - bodyWidth * 3, - bodyWidth); + _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 + _stormtrooperHeight / 3, + bodyHeight * 3, + bodyHeight); } // Рисуем ракеты if (EntityStormtrooper.Rockets) { - int rocketWidth = bodyWidth * 4; - int rocketHeight = bodyWidth / 2; + int rocketWidth = bodyHeight * 4; + int rocketHeight = bodyHeight / 2; Brush brushRed = new SolidBrush(Color.Red); Point[] pointsRocketCockPit = { new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 - rocketHeight, - _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight / 2), + _startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight / 2), new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, - _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2), + _startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2), new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, - _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight) + _startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight) }; Point[] pointsRocketTail = { new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 - rocketHeight + rocketWidth - 10, - _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight / 2), + _startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight / 2), new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 + rocketWidth, - _startPosY + _stormtrooperHeight / 2 - bodyWidth * 2 + rocketHeight / 2), + _startPosY + _stormtrooperHeight / 2 - bodyHeight * 2 + rocketHeight / 2), new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 + rocketWidth, - _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2 + rocketHeight + bodyWidth / 2 - rocketHeight / 2) + _startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight + bodyHeight / 2 - rocketHeight / 2) }; g.FillPolygon(brushRed, pointsRocketCockPit); @@ -257,23 +257,23 @@ namespace ProjectStormtrooper g.FillRectangle(brushAdditionalColor, _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, - _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2, + _startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2, rocketWidth, rocketHeight); g.DrawRectangle(penBlack, _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, - _startPosY + _stormtrooperHeight / 2 - bodyWidth - bodyWidth / 2, + _startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2, rocketWidth, rocketHeight); g.FillRectangle(brushAdditionalColor, _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, - _startPosY + _stormtrooperHeight / 2 + bodyWidth / 2 + bodyWidth / 2, + _startPosY + _stormtrooperHeight / 2 + bodyHeight / 2 + bodyHeight / 2, rocketWidth, rocketHeight); g.DrawRectangle(penBlack, _startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5, - _startPosY + _stormtrooperHeight / 2 + bodyWidth / 2 + bodyWidth / 2, + _startPosY + _stormtrooperHeight / 2 + bodyHeight / 2 + bodyHeight / 2, rocketWidth, rocketHeight); } @@ -282,8 +282,8 @@ namespace ProjectStormtrooper Point[] pointsCockPit = { new Point(_startPosX, _startPosY + _stormtrooperHeight / 2), - new Point(_startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2), - new Point(_startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 + bodyWidth / 2) + new Point(_startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2), + new Point(_startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 + bodyHeight / 2) }; g.FillPolygon(brushBlack, pointsCockPit); @@ -316,8 +316,8 @@ namespace ProjectStormtrooper // Рисуем фюзеляж - g.FillRectangle(brushBodyColor, _startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2, _stormtrooperWidth - _stormtrooperWidth / 8, bodyWidth); - g.DrawRectangle(penBlack, _startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyWidth / 2, _stormtrooperWidth - _stormtrooperWidth / 8, bodyWidth); + g.FillRectangle(brushBodyColor, _startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2, _stormtrooperWidth - _stormtrooperWidth / 8, bodyHeight); + g.DrawRectangle(penBlack, _startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2, _stormtrooperWidth - _stormtrooperWidth / 8, bodyHeight); } } } -- 2.25.1