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 boolean
A variable to see if the tile is solid.protected Renderer
TheRenderer
where the tile will be drawn on.protected BufferedImage
The texture of the tile.protected String
The tile's name.protected int
The x coordinate of the tile.protected int
The y coordinate of the tile. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Draws the tile.Get the texture of the tile.Gets the tile's name.int
getX()
Gets the x coordinate of the tile.int
getY()
Gets the y coordinate of the tile.boolean
isSolid()
Checks if the tile is solid.void
setTileImage
(BufferedImage tileImage) Set the texture of the tile to the given image.void
setTileName
(String tileName) Set the tile's name to the given value.void
setX
(int x) Set the x coordinate of the tile to the given value.void
setY
(int y) Set the y coordinate of the tile to the given value.
-
Field Details
-
render
TheRenderer
where 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
- theRenderer
where 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
- theGraphics
which 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
-