57 lines
1.3 KiB
Java
57 lines
1.3 KiB
Java
|
package Classes.Maps;
|
||
|
|
||
|
import org.w3c.dom.css.RGBColor;
|
||
|
|
||
|
import java.awt.*;
|
||
|
|
||
|
public class NightSkyMap extends AbstractMap {
|
||
|
|
||
|
@Override
|
||
|
protected void GenerateMap()
|
||
|
{
|
||
|
_map = new int[100][100];
|
||
|
_size_x = (float)_width / _map[0].length;
|
||
|
_size_y = (float)_height / _map.length;
|
||
|
int counter = 0;
|
||
|
|
||
|
for (int i = 0; i < _map.length; i++)
|
||
|
{
|
||
|
for (int j = 0; j < _map[i].length; j++)
|
||
|
{
|
||
|
|
||
|
_map[i][j] = _freeRoad;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
while (counter < 20)
|
||
|
{
|
||
|
int x = _random.nextInt(10,90);
|
||
|
int y = _random.nextInt(10,90);
|
||
|
|
||
|
_map[x][ y] = _barrier;
|
||
|
_map[x-1][y] = _barrier;
|
||
|
_map[x + 1][y] = _barrier;
|
||
|
_map[x][y - 1] = _barrier;
|
||
|
|
||
|
counter++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected void DrawRoadPart(Graphics g, int i, int j)
|
||
|
{
|
||
|
g.setColor(Color.black);
|
||
|
g.fillRect((int) (i * _size_x), (int) (j * _size_y), (int) (i * (_size_x + 1)), (int) (j * (_size_y + 1)));
|
||
|
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected void DrawBarrierPart(Graphics g, int i, int j)
|
||
|
{
|
||
|
Color ThundercloudColor = new Color(0,0,139);
|
||
|
g.setColor(ThundercloudColor);
|
||
|
g.fillRect((int) (i * _size_x), (int) (j * _size_y), (int) (i * (_size_x + 1)), (int) (j * (_size_y + 1)));
|
||
|
|
||
|
}
|
||
|
}
|