Проверенно преподом. Не pull request
This commit is contained in:
parent
993e92ab6c
commit
74cc61815c
@ -24,9 +24,10 @@ namespace WarmlyShip
|
||||
|
||||
public void SetPosition(int x, int y, int width, int height)
|
||||
{
|
||||
if (width < _warmlyShipWidth || height < _warmlyShipHeight) return;
|
||||
Random random = new Random();
|
||||
_startPosX = x < 0 || x > width ? random.Next(0, width) : x;
|
||||
_startPosY = y < 0 || y > height ? random.Next(0, height) : y;
|
||||
_startPosX = x < 0 || x + _warmlyShipWidth > width ? random.Next(0, width - _warmlyShipWidth) : x;
|
||||
_startPosY = y < 0 || y + _warmlyShipHeight > height ? random.Next(0, height - _warmlyShipHeight) : y;
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace WarmlyShip
|
||||
Random random = new Random();
|
||||
_warmlyShip = new DrawingWarmlyShip();
|
||||
_warmlyShip.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
||||
_warmlyShip.SetPosition(random.Next(10, 100), random.Next(10, 100), pictureBox.Width, pictureBox.Height);
|
||||
_warmlyShip.SetPosition(random.Next(pictureBox.Width - 150, pictureBox.Width - 125), random.Next(pictureBox.Height - 150, pictureBox.Height - 50), pictureBox.Width, pictureBox.Height);
|
||||
toolStripStatusSpeed.Text = $"Ñêîðîñòü: {_warmlyShip.warmlyShip?.Speed}";
|
||||
toolStripStatusWeight.Text = $"Âåñ: {_warmlyShip.warmlyShip?.Weight}";
|
||||
toolStripStatusLabelBodyColor.Text = $"Öâåò: {_warmlyShip.warmlyShip?.BodyColor}";
|
||||
|
Loading…
Reference in New Issue
Block a user