Pyatakov K.M. LabWork1 #1
@ -9,14 +9,9 @@ namespace Stormtrooper
|
||||
internal enum Direction
|
||||
|
||||
{
|
||||
Stop,
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right,
|
||||
RightUp,
|
||||
LeftUp,
|
||||
RightDown,
|
||||
LeftDown
|
||||
Right
|
||||
}
|
||||
}
|
||||
|
@ -95,34 +95,7 @@ namespace Stormtrooper
|
||||
_startPosY += Airplane.Step;
|
||||
}
|
||||
break;
|
||||
case Direction.RightUp:
|
||||
if (_startPosX + _airplaneWidth + Airplane.Step < _pictureWidth && _startPosY - Airplane.Step > 0)
|
||||
{
|
||||
_startPosX += Airplane.Step;
|
||||
_startPosY -= Airplane.Step;
|
||||
}
|
||||
break;
|
||||
case Direction.RightDown:
|
||||
if (_startPosY + _airplaneHeight + Airplane.Step < _pictureHeight && _startPosX + _airplaneWidth + Airplane.Step < _pictureWidth)
|
||||
{
|
||||
_startPosY += Airplane.Step;
|
||||
_startPosX += Airplane.Step;
|
||||
}
|
||||
break;
|
||||
case Direction.LeftUp:
|
||||
if (_startPosX - Airplane.Step > 0 && _startPosY - Airplane.Step > 0)
|
||||
{
|
||||
_startPosX -= Airplane.Step;
|
||||
_startPosY -= Airplane.Step;
|
||||
}
|
||||
break;
|
||||
case Direction.LeftDown:
|
||||
if (_startPosY + _airplaneHeight + Airplane.Step < _pictureHeight && _startPosX - Airplane.Step > 0)
|
||||
{
|
||||
_startPosY += Airplane.Step;
|
||||
_startPosX -= Airplane.Step;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
58
Stormtrooper/Stormtrooper/MainForm.Designer.cs
generated
58
Stormtrooper/Stormtrooper/MainForm.Designer.cs
generated
@ -39,10 +39,6 @@ namespace Stormtrooper
|
||||
this.buttonDown = new System.Windows.Forms.Button();
|
||||
this.buttonLeft = new System.Windows.Forms.Button();
|
||||
this.buttonRight = new System.Windows.Forms.Button();
|
||||
this.buttonLeftDown = new System.Windows.Forms.Button();
|
||||
this.buttonLeftUp = new System.Windows.Forms.Button();
|
||||
this.buttonRightUp = new System.Windows.Forms.Button();
|
||||
this.buttonRightDown = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirplane)).BeginInit();
|
||||
this.toolStripStatus.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -107,7 +103,7 @@ namespace Stormtrooper
|
||||
// buttonUp
|
||||
//
|
||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonUp.Location = new System.Drawing.Point(1031, 447);
|
||||
this.buttonUp.Location = new System.Drawing.Point(1031, 482);
|
||||
this.buttonUp.Name = "buttonUp";
|
||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonUp.TabIndex = 3;
|
||||
@ -127,7 +123,7 @@ namespace Stormtrooper
|
||||
// buttonLeft
|
||||
//
|
||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonLeft.Location = new System.Drawing.Point(995, 482);
|
||||
this.buttonLeft.Location = new System.Drawing.Point(995, 517);
|
||||
this.buttonLeft.Name = "buttonLeft";
|
||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonLeft.TabIndex = 5;
|
||||
@ -137,62 +133,18 @@ namespace Stormtrooper
|
||||
// buttonRight
|
||||
//
|
||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonRight.Location = new System.Drawing.Point(1067, 482);
|
||||
this.buttonRight.Location = new System.Drawing.Point(1067, 517);
|
||||
this.buttonRight.Name = "buttonRight";
|
||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonRight.TabIndex = 6;
|
||||
this.buttonRight.UseVisualStyleBackColor = true;
|
||||
this.buttonRight.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonLeftDown
|
||||
//
|
||||
this.buttonLeftDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonLeftDown.Location = new System.Drawing.Point(995, 518);
|
||||
this.buttonLeftDown.Name = "buttonLeftDown";
|
||||
this.buttonLeftDown.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonLeftDown.TabIndex = 7;
|
||||
this.buttonLeftDown.UseVisualStyleBackColor = true;
|
||||
this.buttonLeftDown.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonLeftUp
|
||||
//
|
||||
this.buttonLeftUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonLeftUp.Location = new System.Drawing.Point(995, 447);
|
||||
this.buttonLeftUp.Name = "buttonLeftUp";
|
||||
this.buttonLeftUp.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonLeftUp.TabIndex = 8;
|
||||
this.buttonLeftUp.UseVisualStyleBackColor = true;
|
||||
this.buttonLeftUp.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonRightUp
|
||||
//
|
||||
this.buttonRightUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonRightUp.Location = new System.Drawing.Point(1067, 447);
|
||||
this.buttonRightUp.Name = "buttonRightUp";
|
||||
this.buttonRightUp.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonRightUp.TabIndex = 9;
|
||||
this.buttonRightUp.UseVisualStyleBackColor = true;
|
||||
this.buttonRightUp.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonRightDown
|
||||
//
|
||||
this.buttonRightDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonRightDown.Location = new System.Drawing.Point(1067, 518);
|
||||
this.buttonRightDown.Name = "buttonRightDown";
|
||||
this.buttonRightDown.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonRightDown.TabIndex = 10;
|
||||
this.buttonRightDown.UseVisualStyleBackColor = true;
|
||||
this.buttonRightDown.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1151, 609);
|
||||
this.Controls.Add(this.buttonRightDown);
|
||||
this.Controls.Add(this.buttonRightUp);
|
||||
this.Controls.Add(this.buttonLeftUp);
|
||||
this.Controls.Add(this.buttonLeftDown);
|
||||
this.Controls.Add(this.buttonRight);
|
||||
this.Controls.Add(this.buttonLeft);
|
||||
this.Controls.Add(this.buttonDown);
|
||||
@ -222,10 +174,6 @@ namespace Stormtrooper
|
||||
private System.Windows.Forms.Button buttonDown;
|
||||
private System.Windows.Forms.Button buttonLeft;
|
||||
private System.Windows.Forms.Button buttonRight;
|
||||
private System.Windows.Forms.Button buttonLeftDown;
|
||||
private System.Windows.Forms.Button buttonLeftUp;
|
||||
private System.Windows.Forms.Button buttonRightUp;
|
||||
private System.Windows.Forms.Button buttonRightDown;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,18 +62,6 @@ namespace Stormtrooper
|
||||
case "buttonRight":
|
||||
_airplane?.MoveAirplane(Direction.Right);
|
||||
break;
|
||||
case "buttonRightUp":
|
||||
_airplane?.MoveAirplane(Direction.RightUp);
|
||||
break;
|
||||
case "buttonRightDown":
|
||||
_airplane?.MoveAirplane(Direction.RightDown);
|
||||
break;
|
||||
case "buttonLeftUp":
|
||||
_airplane?.MoveAirplane(Direction.LeftUp);
|
||||
break;
|
||||
case "buttonLeftDown":
|
||||
_airplane?.MoveAirplane(Direction.RightDown);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user