Готовая лаб 2
This commit is contained in:
parent
b740601834
commit
45bf8f801a
@ -33,7 +33,6 @@ namespace Locomotive
|
|||||||
|
|
||||||
public Bitmap MoveObject(Direction direction)
|
public Bitmap MoveObject(Direction direction)
|
||||||
{
|
{
|
||||||
// added logic must be checked!
|
|
||||||
bool isFree = true;
|
bool isFree = true;
|
||||||
|
|
||||||
int startPosX = (int)(_drawningObject.GetCurrentPosition().Left / _size_x);
|
int startPosX = (int)(_drawningObject.GetCurrentPosition().Left / _size_x);
|
||||||
@ -117,8 +116,6 @@ namespace Locomotive
|
|||||||
int y = _random.Next(0, 10);
|
int y = _random.Next(0, 10);
|
||||||
_drawningObject.SetObject(x, y, _width, _height);
|
_drawningObject.SetObject(x, y, _width, _height);
|
||||||
|
|
||||||
// added logic must be checked!
|
|
||||||
|
|
||||||
for (int i = 0; i < _map.GetLength(0); ++i)
|
for (int i = 0; i < _map.GetLength(0); ++i)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < _map.GetLength(1); ++j)
|
for (int j = 0; j < _map.GetLength(1); ++j)
|
||||||
|
@ -107,7 +107,7 @@ namespace Locomotive
|
|||||||
}
|
}
|
||||||
Pen pen = new(Color.Black);
|
Pen pen = new(Color.Black);
|
||||||
//тело
|
//тело
|
||||||
g.DrawRectangle(pen, _startPosX , _startPosY, 110 - 10, 50 - 10);
|
g.FillRectangle(new SolidBrush(Color.MediumBlue), _startPosX , _startPosY, 110 - 10, 50 - 10);
|
||||||
//окна
|
//окна
|
||||||
g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 10, _startPosY + 10, 10, 10);
|
g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 10, _startPosY + 10, 10, 10);
|
||||||
g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 30, _startPosY + 10, 10, 10);
|
g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 30, _startPosY + 10, 10, 10);
|
||||||
@ -115,10 +115,10 @@ namespace Locomotive
|
|||||||
//дверь
|
//дверь
|
||||||
g.DrawRectangle(pen, _startPosX + 50, _startPosY + 10, 10, 20);
|
g.DrawRectangle(pen, _startPosX + 50, _startPosY + 10, 10, 20);
|
||||||
//колеса
|
//колеса
|
||||||
g.DrawEllipse(pen, _startPosX, _startPosY + 40, 10, 10);
|
g.FillEllipse(new SolidBrush(Color.Black), _startPosX, _startPosY + 40, 10, 10);
|
||||||
g.DrawEllipse(pen, _startPosX + 20, _startPosY + 40, 10, 10);
|
g.FillEllipse(new SolidBrush(Color.Black), _startPosX + 20, _startPosY + 40, 10, 10);
|
||||||
g.DrawEllipse(pen, _startPosX + 70, _startPosY + 40, 10, 10);
|
g.FillEllipse(new SolidBrush(Color.Black), _startPosX + 70, _startPosY + 40, 10, 10);
|
||||||
g.DrawEllipse(pen, _startPosX + 90, _startPosY + 40, 10, 10);
|
g.FillEllipse(new SolidBrush(Color.Black), _startPosX + 90, _startPosY + 40, 10, 10);
|
||||||
//черный прямоугольник
|
//черный прямоугольник
|
||||||
g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 100, _startPosY + 10, 10, 30);
|
g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 100, _startPosY + 10, 10, 30);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace Locomotive
|
|||||||
/// Цвет участка закрытого
|
/// Цвет участка закрытого
|
||||||
private readonly Brush barrierColor = new SolidBrush(Color.Black);
|
private readonly Brush barrierColor = new SolidBrush(Color.Black);
|
||||||
/// Цвет участка открытого
|
/// Цвет участка открытого
|
||||||
private readonly Brush roadColor = new SolidBrush(Color.Gray);
|
private readonly Brush roadColor = new SolidBrush(Color.Pink);
|
||||||
|
|
||||||
protected override void DrawBarrierPart(Graphics g, int i, int j)
|
protected override void DrawBarrierPart(Graphics g, int i, int j)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ namespace Locomotive
|
|||||||
/// Цвет участка закрытого
|
/// Цвет участка закрытого
|
||||||
private readonly Brush barrierColor = new SolidBrush(Color.Black);
|
private readonly Brush barrierColor = new SolidBrush(Color.Black);
|
||||||
/// Цвет участка открытого
|
/// Цвет участка открытого
|
||||||
private readonly Brush roadColor = new SolidBrush(Color.Gray);
|
private readonly Brush roadColor = new SolidBrush(Color.Green);
|
||||||
|
|
||||||
protected override void DrawBarrierPart(Graphics g, int i, int j)
|
protected override void DrawBarrierPart(Graphics g, int i, int j)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user