Лаба№1. Не проверена преподавателем.
This commit is contained in:
parent
fb90f09de8
commit
993e92ab6c
@ -24,8 +24,9 @@ namespace WarmlyShip
|
|||||||
|
|
||||||
public void SetPosition(int x, int y, int width, int height)
|
public void SetPosition(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
_startPosX = x;
|
Random random = new Random();
|
||||||
_startPosY = y;
|
_startPosX = x < 0 || x > width ? random.Next(0, width) : x;
|
||||||
|
_startPosY = y < 0 || y > height ? random.Next(0, height) : y;
|
||||||
_pictureWidth = width;
|
_pictureWidth = width;
|
||||||
_pictureHeight = height;
|
_pictureHeight = height;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user