43 lines
771 B
Java
Raw Normal View History

2015-02-14 17:48:55 -05:00
package milleniumlegacy;
import java.awt.Color;
import java.awt.Graphics;
public class Tile
{
int x,y;
char terrain;
boolean up, down, left, right;
int offsetx;
int offsety;
public Tile(int x, int y, char terrain)
{
this.x = x;
this.y = y;
this.terrain = terrain;
}
public void Render(Graphics g, int offsetx, int offsety)
{
2015-02-14 20:53:36 -05:00
if (terrain == 'd')
2015-02-14 17:48:55 -05:00
{
g.setColor(Color.GREEN);
}
2015-02-14 20:53:36 -05:00
else if (terrain == 'r')
{
g.setColor(Color.DARK_GRAY);
}
else if (terrain == 'c')
{
g.setColor(Color.gray);
}
2015-02-14 17:48:55 -05:00
else
{
2015-02-14 20:53:36 -05:00
g.setColor(Color.blue);
2015-02-14 17:48:55 -05:00
}
2015-02-14 20:53:36 -05:00
g.fillRect(x*32 + offsetx - 32, y*32 + offsety - 32, 32,32);
String draw = "x" + x + "y" + y;
g.setColor(Color.black);
g.drawString(draw, x*32 + offsetx - 32, y*32 + 8 + offsety - 32);
2015-02-14 17:48:55 -05:00
}
}