Package dev.kyzel.game.world.tile
Class Tile
java.lang.Object
dev.kyzel.game.world.tile.Tile
- Direct Known Subclasses:
AnimatedTile
The tile class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanA variable to see if the tile is solid.protected RendererTheRendererwhere the tile will be drawn on.protected BufferedImageThe texture of the tile.protected StringThe tile's name.protected intThe x coordinate of the tile.protected intThe y coordinate of the tile. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDraws the tile.Get the texture of the tile.Gets the tile's name.intgetX()Gets the x coordinate of the tile.intgetY()Gets the y coordinate of the tile.booleanisSolid()Checks if the tile is solid.voidsetTileImage(BufferedImage tileImage) Set the texture of the tile to the given image.voidsetTileName(String tileName) Set the tile's name to the given value.voidsetX(int x) Set the x coordinate of the tile to the given value.voidsetY(int y) Set the y coordinate of the tile to the given value.
-
Field Details
-
render
TheRendererwhere the tile will be drawn on. -
tileName
The tile's name. -
isSolid
protected boolean isSolidA variable to see if the tile is solid. -
x
protected int xThe x coordinate of the tile. -
y
protected int yThe y coordinate of the tile. -
tileImage
The texture of the tile.
-
-
Constructor Details
-
Tile
Creates a new tile.- Parameters:
render- theRendererwhere the tile will be drawn onx- the x coordinate of the tiley- the y coordinate of the tiletileName- the tile's nameisSolid- is the tile solid
-
-
Method Details
-
getX
public int getX()Gets the x coordinate of the tile.- Returns:
- the x coordinate of the tile
-
setX
public void setX(int x) Set the x coordinate of the tile to the given value.- Parameters:
x- the given value
-
getY
public int getY()Gets the y coordinate of the tile.- Returns:
- the y coordinate of the tile
-
setY
public void setY(int y) Set the y coordinate of the tile to the given value.- Parameters:
y- the given value
-
draw
Draws the tile.- Parameters:
g- theGraphicswhich is used to draw
-
isSolid
public boolean isSolid()Checks if the tile is solid.- Returns:
- if the tile is solid
-
getTileName
Gets the tile's name.- Returns:
- the tile's name
-
setTileName
Set the tile's name to the given value.- Parameters:
tileName- the given value
-
getTileImage
Get the texture of the tile.- Returns:
- the texture of the tile
-
setTileImage
Set the texture of the tile to the given image.- Parameters:
tileImage- the given image
-