Überlauftexturen für Wald in Code eingefügt
This commit is contained in:
@@ -17,6 +17,10 @@ namespace WorldOfPeacecraft
|
||||
private Image Dragon2;
|
||||
private Image Dragon3;
|
||||
private Image Forest;
|
||||
private Image ForestLeft;
|
||||
private Image ForestRight;
|
||||
private Image ForestTop;
|
||||
private Image ForestBottom;
|
||||
private Image Knight;
|
||||
private Image Walkable;
|
||||
private Image Water;
|
||||
@@ -35,6 +39,10 @@ namespace WorldOfPeacecraft
|
||||
Dragon2 = Image.FromFile (ImagesFolder + "dragon2.png");
|
||||
Dragon3 = Image.FromFile (ImagesFolder + "dragon3.png");
|
||||
Forest = Image.FromFile (ImagesFolder + "forest.png");
|
||||
ForestLeft = Image.FromFile (ImagesFolder + "forest_left.png");
|
||||
ForestRight = Image.FromFile (ImagesFolder + "forest_right.png");
|
||||
ForestTop = Image.FromFile (ImagesFolder + "forest_top.png");
|
||||
ForestBottom = Image.FromFile (ImagesFolder + "forest_bottom.png");
|
||||
Knight = Image.FromFile (ImagesFolder + "knight.png");
|
||||
Walkable = Image.FromFile (ImagesFolder + "walkable.jpg");
|
||||
Water = Image.FromFile (ImagesFolder + "water.jpg");
|
||||
@@ -96,9 +104,7 @@ namespace WorldOfPeacecraft
|
||||
FlowerCounter = 0;
|
||||
for (int y = 0; y < map.GetLength(1); y++) {
|
||||
for (int x = 0; x < map.GetLength(0); x++) {
|
||||
int posx = x * TileSize;
|
||||
int posy = y * TileSize;
|
||||
PaintTile (g, map [x, y], posx, posy);
|
||||
PaintTile (g, map, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,8 +113,11 @@ namespace WorldOfPeacecraft
|
||||
}
|
||||
}
|
||||
|
||||
public void PaintTile (Graphics g, ITile tile, int x, int y)
|
||||
public void PaintTile (Graphics g, ITile[,] map, int locx, int locy)
|
||||
{
|
||||
ITile tile = map [locx, locy];
|
||||
int x = locx * TileSize;
|
||||
int y = locy * TileSize;
|
||||
Image image = null;
|
||||
if (tile.IsWater ()) {
|
||||
image = Water;
|
||||
@@ -124,6 +133,18 @@ namespace WorldOfPeacecraft
|
||||
}
|
||||
if (tile.IsForest ()) {
|
||||
PaintImage (g, x, y, Forest);
|
||||
if (locx > 0 && map[locx - 1,locy].IsForest()) {
|
||||
PaintImage(g, x, y, ForestLeft);
|
||||
}
|
||||
if (locx < map.GetLength(0) - 1 && map[locx + 1,locy].IsForest()) {
|
||||
PaintImage (g, x, y, ForestRight);
|
||||
}
|
||||
if (locy > 0 && map[locx, locy - 1].IsForest()) {
|
||||
PaintImage (g, x, y, ForestTop);
|
||||
}
|
||||
if (locy < map.GetLength(1) - 1 && map[locx, locy + 1].IsForest()) {
|
||||
PaintImage (g, x, y, ForestBottom);
|
||||
}
|
||||
} else if (tile.IsWalkable()) {
|
||||
if (FlowerCounter == 4) {
|
||||
PaintImage (g, x, y, Flowers);
|
||||
|
||||
Reference in New Issue
Block a user