diff --git a/ProjectStormTrooper/ProjectStormTrooper/Class1.cs b/ProjectStormTrooper/ProjectStormTrooper/Class1.cs new file mode 100644 index 0000000..33fd86c --- /dev/null +++ b/ProjectStormTrooper/ProjectStormTrooper/Class1.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectStormTrooper; + +public class EntityStormTrooper +{ + //speed + public int Speed { get; private set; } + + //weight + public double Weight { get; private set; } + + //maincolor + + public Color BodyColor { get; private set; } + + //additionalcolor + + public Color AdditionalColor { get; private set; } + + public bool BodyRockets { get; private set; } + + public bool Bombs { get; private set; } + + + //movement + + public double Step => Speed * 500 / Weight; + + public bool Wing { get; private set; } + public void Init(bool wing, int speed, double weight, Color bodyColor, Color additionalColor, bool bodyRockets, bool bombs) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + AdditionalColor = additionalColor; + Wing = wing; + BodyRockets = bodyRockets; + Bombs = bombs; + + } + + +} + diff --git a/ProjectStormTrooper/ProjectStormTrooper/DirectionType.cs b/ProjectStormTrooper/ProjectStormTrooper/DirectionType.cs new file mode 100644 index 0000000..e0d1625 --- /dev/null +++ b/ProjectStormTrooper/ProjectStormTrooper/DirectionType.cs @@ -0,0 +1,14 @@ +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/DrawingStormTrooper.cs b/ProjectStormTrooper/ProjectStormTrooper/DrawingStormTrooper.cs new file mode 100644 index 0000000..7127c4f --- /dev/null +++ b/ProjectStormTrooper/ProjectStormTrooper/DrawingStormTrooper.cs @@ -0,0 +1,224 @@ +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; } + + //windowswidth + + private int? _pictureWidth; + + private int? _pictureHeight; + + private int? _startPosX; + + private int? _startPosY; + + private readonly int _drawingTrooperWidth = 140; + + private readonly int _drawingTrooperHeight = 120; + + public void Init(bool wing, int speed, double weight, Color bodyColor, Color additionalColor, bool bodyRockets, bool bombs) + { + EntityStormTrooper = new EntityStormTrooper(); + EntityStormTrooper.Init(wing, speed, weight, bodyColor, additionalColor, bodyRockets, bombs); + _pictureWidth = null; + _pictureHeight = null; + _startPosX = null; + _startPosY = null; + } + + public bool SetPictureSize(int width, int height) + { + + if (_drawingTrooperHeight > height || _drawingTrooperWidth > width) { return false; } + + _pictureWidth = width; + + _pictureHeight = height; + return true; + } + public void SetPosition(int x, int y) + { + if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + if (x < 0 || y < 0 || x + _drawingTrooperWidth > _pictureWidth || y + _drawingTrooperHeight > _pictureHeight) + { + return; + } + _startPosX = x; + _startPosY = y; + } + public bool MoveStormTrooper(DirectionType direction) + { + if (EntityStormTrooper == null || !_startPosX.HasValue || !_startPosY.HasValue) + { + return false; + } + switch (direction) + { + //влево + case DirectionType.Left: + if (_startPosX.Value - EntityStormTrooper.Step > 0) + { + _startPosX -= (int)EntityStormTrooper.Step; + } + return true; + //вверх + case DirectionType.Up: + if (_startPosY.Value - EntityStormTrooper.Step > 0) + { + _startPosY -= (int)EntityStormTrooper.Step; + } + return true; + // вправо + case DirectionType.Right: + if (_startPosX.Value + EntityStormTrooper.Step + _drawingTrooperWidth < _pictureWidth) + { + _startPosX += (int)EntityStormTrooper.Step; + } + return true; + //вниз + case DirectionType.Down: + if (_startPosY.Value + EntityStormTrooper.Step + _drawingTrooperHeight< _pictureHeight) + { + _startPosY += (int)EntityStormTrooper.Step; + } + return true; + default: + return false; + } + } + + public void DrawTransport(Graphics g) + { + if (EntityStormTrooper == null || !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) return; + Pen pen = new(EntityStormTrooper.BodyColor) + { + Width = 2 + }; + Pen additionalPen = new(EntityStormTrooper.AdditionalColor) + { + Width = 2 + }; + Brush brushBlack = new SolidBrush(EntityStormTrooper.BodyColor); + Brush additionalBrush = new SolidBrush(EntityStormTrooper.AdditionalColor); + + + if (EntityStormTrooper.BodyRockets) + { + // Толщина толстой палочки ракеты + int rocketWidth = 6; + // Длина толстой палочки ракеты + int rocketLength = 15; + + PointF[] rocketsTop = + { + new(_startPosX.Value + 90, _startPosY.Value + 13), + new(_startPosX.Value + 90, _startPosY.Value + 33) + }; + + PointF[] rocketsBottom = + { + new(_startPosX.Value + 90, _startPosY.Value + 103), + new(_startPosX.Value + 90, _startPosY.Value + 123) + }; + + // Прорисовка ракет на верхнем крыле + foreach (PointF rocketPos in rocketsTop) + { + // Толстая палочка для ракеты + g.FillRectangle(additionalBrush, rocketPos.X, rocketPos.Y - (rocketWidth / 2), rocketLength, rocketWidth); + } + + // Прорисовка ракет на нижнем крыле + foreach (PointF rocketPos in rocketsBottom) + { + // Толстая палочка для ракеты + g.FillRectangle(additionalBrush, rocketPos.X, rocketPos.Y - (rocketWidth / 2), rocketLength, rocketWidth); + } + } + + // Прорисовка бомб под крыльями + if (EntityStormTrooper.Bombs) + { + int bombWidth = 10; + int bombHeight = 15; + + // Позиции бомб под верхним и нижним крылом + PointF[] bombs = + { + new(_startPosX.Value + 75, _startPosY.Value + 15), // Под верхним крылом + new(_startPosX.Value + 75, _startPosY.Value + 105) // Под нижним крылом +}; + + // Рисуем бомбы + foreach (PointF bombPos in bombs) + { + g.FillEllipse(additionalBrush, bombPos.X, bombPos.Y, bombWidth, bombHeight); + g.DrawEllipse(pen, bombPos.X, bombPos.Y, bombWidth, bombHeight); + } + } + // Определение точек основных элементов объекта + PointF[] front = + { + new(_startPosX.Value + 130, _startPosY.Value + 53), + new(_startPosX.Value + 155, _startPosY.Value + 66), + new(_startPosX.Value + 130, _startPosY.Value + 79) + }; + + PointF[] tailTop = + { + new(_startPosX.Value, _startPosY.Value + 23), + new(_startPosX.Value, _startPosY.Value + 53), + new(_startPosX.Value + 20, _startPosY.Value + 53), + new(_startPosX.Value + 20, _startPosY.Value + 38) + }; + + PointF[] tailBottom = + { + new(_startPosX.Value, _startPosY.Value + 79), + new(_startPosX.Value, _startPosY.Value + 109), + new(_startPosX.Value + 20, _startPosY.Value + 94), + new(_startPosX.Value + 20, _startPosY.Value + 79) + }; + + PointF[] wingTop = + { + new(_startPosX.Value + 90, _startPosY.Value), + new(_startPosX.Value + 90, _startPosY.Value + 53), + new(_startPosX.Value + 60, _startPosY.Value + 53), + new(_startPosX.Value + 75, _startPosY.Value), + }; + + PointF[] wingBottom = + { + new(_startPosX.Value + 90, _startPosY.Value + 79), + new(_startPosX.Value + 90, _startPosY.Value + 133), + new(_startPosX.Value + 75, _startPosY.Value + 133), + new(_startPosX.Value + 60, _startPosY.Value + 79), + }; + + // Прорисовка основных элементов объекта + g.FillPolygon(brushBlack, front); + g.DrawPolygon(pen, tailTop); + g.DrawPolygon(pen, tailBottom); + g.DrawPolygon(pen, wingTop); + g.DrawPolygon(pen, wingBottom); + g.DrawRectangle(pen, (int)_startPosX, (int)_startPosY + 53, 130, 26); + } +} + + diff --git a/ProjectStormTrooper/ProjectStormTrooper/Form1.Designer.cs b/ProjectStormTrooper/ProjectStormTrooper/Form1.Designer.cs deleted file mode 100644 index 3f39604..0000000 --- a/ProjectStormTrooper/ProjectStormTrooper/Form1.Designer.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace ProjectStormTrooper -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - SuspendLayout(); - // - // Form1 - // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1138, 450); - Name = "Form1"; - Text = "Form1"; - Load += Form1_Load; - ResumeLayout(false); - } - - #endregion - } -} diff --git a/ProjectStormTrooper/ProjectStormTrooper/Form1.cs b/ProjectStormTrooper/ProjectStormTrooper/Form1.cs deleted file mode 100644 index 7c919eb..0000000 --- a/ProjectStormTrooper/ProjectStormTrooper/Form1.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace ProjectStormTrooper -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - - private void Form1_Load(object sender, EventArgs e) - { - - } - } -} diff --git a/ProjectStormTrooper/ProjectStormTrooper/Program.cs b/ProjectStormTrooper/ProjectStormTrooper/Program.cs index 18a9f60..1c17eba 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 StormTrooperForm()); } } } \ No newline at end of file diff --git a/ProjectStormTrooper/ProjectStormTrooper/ProjectStormTrooper.csproj b/ProjectStormTrooper/ProjectStormTrooper/ProjectStormTrooper.csproj index 663fdb8..af03d74 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..8cc1b53 --- /dev/null +++ b/ProjectStormTrooper/ProjectStormTrooper/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ProjectStormTrooper.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow_down { + get { + object obj = ResourceManager.GetObject("arrow_down", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow_left { + get { + object obj = ResourceManager.GetObject("arrow_left", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow_right { + get { + object obj = ResourceManager.GetObject("arrow_right", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap arrow_up { + get { + object obj = ResourceManager.GetObject("arrow_up", 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..3df26db --- /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 + + + + ..\arrows\arrow_down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\arrows\arrow_left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\arrows\arrow_right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\arrows\arrow_up.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/StormTrooperForm.Designer.cs b/ProjectStormTrooper/ProjectStormTrooper/StormTrooperForm.Designer.cs new file mode 100644 index 0000000..6956ae4 --- /dev/null +++ b/ProjectStormTrooper/ProjectStormTrooper/StormTrooperForm.Designer.cs @@ -0,0 +1,139 @@ +namespace ProjectStormTrooper +{ + partial class StormTrooperForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + buttonCreate = new Button(); + buttonLeft = new Button(); + buttonRight = new Button(); + buttonUp = new Button(); + buttonDown = new Button(); + pictureBox2 = new PictureBox(); + ((System.ComponentModel.ISupportInitialize)pictureBox2).BeginInit(); + SuspendLayout(); + // + // buttonCreate + // + buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonCreate.Location = new Point(12, 409); + buttonCreate.Name = "buttonCreate"; + buttonCreate.Size = new Size(94, 29); + buttonCreate.TabIndex = 1; + buttonCreate.Text = "Create"; + buttonCreate.UseVisualStyleBackColor = true; + buttonCreate.Click += ButtonCreate_Click; + // + // buttonLeft + // + buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonLeft.BackgroundImage = Properties.Resources.arrow_left; + buttonLeft.BackgroundImageLayout = ImageLayout.Zoom; + buttonLeft.Location = new Point(759, 377); + buttonLeft.Name = "buttonLeft"; + buttonLeft.Size = new Size(30, 30); + buttonLeft.TabIndex = 2; + buttonLeft.UseVisualStyleBackColor = true; + buttonLeft.Click += ButtonMove_Click; + // + // buttonRight + // + buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonRight.BackgroundImage = Properties.Resources.arrow_right; + buttonRight.BackgroundImageLayout = ImageLayout.Zoom; + buttonRight.Location = new Point(831, 377); + buttonRight.Name = "buttonRight"; + buttonRight.Size = new Size(30, 30); + buttonRight.TabIndex = 3; + buttonRight.UseVisualStyleBackColor = true; + buttonRight.Click += ButtonMove_Click; + // + // buttonUp + // + buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonUp.BackgroundImage = Properties.Resources.arrow_up; + buttonUp.BackgroundImageLayout = ImageLayout.Zoom; + buttonUp.Location = new Point(795, 350); + buttonUp.Name = "buttonUp"; + buttonUp.Size = new Size(30, 30); + buttonUp.TabIndex = 4; + buttonUp.UseVisualStyleBackColor = true; + buttonUp.Click += ButtonMove_Click; + // + // buttonDown + // + buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonDown.BackgroundImage = Properties.Resources.arrow_down; + buttonDown.BackgroundImageLayout = ImageLayout.Zoom; + buttonDown.Location = new Point(795, 409); + buttonDown.Name = "buttonDown"; + buttonDown.Size = new Size(30, 30); + buttonDown.TabIndex = 5; + buttonDown.UseVisualStyleBackColor = true; + buttonDown.Click += ButtonMove_Click; + // + // pictureBox2 + // + pictureBox2.Dock = DockStyle.Fill; + pictureBox2.Location = new Point(0, 0); + pictureBox2.Name = "pictureBox2"; + pictureBox2.Size = new Size(882, 453); + pictureBox2.SizeMode = PictureBoxSizeMode.AutoSize; + pictureBox2.TabIndex = 6; + pictureBox2.TabStop = false; + pictureBox2.Click += ButtonMove_Click; + // + // StormTrooperForm + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(882, 453); + Controls.Add(buttonDown); + Controls.Add(buttonUp); + Controls.Add(buttonRight); + Controls.Add(buttonLeft); + Controls.Add(buttonCreate); + Controls.Add(pictureBox2); + Name = "StormTrooperForm"; + StartPosition = FormStartPosition.CenterScreen; + Text = "StormTrooperForm"; + Load += StormTrooperForm_Load; + Click += ButtonMove_Click; + ((System.ComponentModel.ISupportInitialize)pictureBox2).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + private Button buttonCreate; + private Button buttonLeft; + private Button buttonRight; + private Button buttonUp; + private Button buttonDown; + private PictureBox pictureBox2; + } +} \ No newline at end of file diff --git a/ProjectStormTrooper/ProjectStormTrooper/StormTrooperForm.cs b/ProjectStormTrooper/ProjectStormTrooper/StormTrooperForm.cs new file mode 100644 index 0000000..72a88de --- /dev/null +++ b/ProjectStormTrooper/ProjectStormTrooper/StormTrooperForm.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectStormTrooper +{ + public partial class StormTrooperForm : Form + { + private DrawingStormTrooper? _drawingStormTrooper; + + public StormTrooperForm() + { + InitializeComponent(); + } + + public void Draw() + { + if (_drawingStormTrooper == null) + { + return; + } + Bitmap bmp = new(pictureBox2.Width, pictureBox2.Height); + Graphics gr = Graphics.FromImage(bmp); + _drawingStormTrooper.DrawTransport(gr); + pictureBox2.Image = bmp; + } + + + + + private void PictureBox2_Click(object sender, EventArgs e) + { + + } + + private void StormTrooperForm_Load(object sender, EventArgs e) + { + + } + + private void ButtonCreate_Click(object sender, EventArgs e) + { + Random random = new(); + _drawingStormTrooper = new DrawingStormTrooper(); + _drawingStormTrooper.Init(Convert.ToBoolean(random.Next(0, 2)), 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))); + _drawingStormTrooper.SetPictureSize(pictureBox2.Width, + pictureBox2.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 name = ((Button)sender)?.Name ?? string.Empty; + bool result = false; + switch (name) + { + case "buttonUp": + result = + _drawingStormTrooper.MoveStormTrooper(DirectionType.Up); + break; + case "buttonDown": + result = + _drawingStormTrooper.MoveStormTrooper(DirectionType.Down); + break; + case "buttonLeft": + result = + _drawingStormTrooper.MoveStormTrooper(DirectionType.Left); + break; + case "buttonRight": + result = + _drawingStormTrooper.MoveStormTrooper(DirectionType.Right); + break; + } + + if (result) + { + Draw(); + } + } + } +} diff --git a/ProjectStormTrooper/ProjectStormTrooper/Form1.resx b/ProjectStormTrooper/ProjectStormTrooper/StormTrooperForm.resx similarity index 100% rename from ProjectStormTrooper/ProjectStormTrooper/Form1.resx rename to ProjectStormTrooper/ProjectStormTrooper/StormTrooperForm.resx diff --git a/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_down.png b/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_down.png new file mode 100644 index 0000000..6acd289 Binary files /dev/null and b/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_down.png differ diff --git a/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_left.png b/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_left.png new file mode 100644 index 0000000..3a6835b Binary files /dev/null and b/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_left.png differ diff --git a/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_right.png b/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_right.png new file mode 100644 index 0000000..9482d9f Binary files /dev/null and b/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_right.png differ diff --git a/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_up.png b/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_up.png new file mode 100644 index 0000000..e0505d7 Binary files /dev/null and b/ProjectStormTrooper/ProjectStormTrooper/arrows/arrow_up.png differ