Class Cell
java.lang.Object
fr.r1r0r0.deltaengine.model.elements.cells.Cell
- All Implemented Interfaces:
Element<java.lang.Integer>
- Direct Known Subclasses:
CrossableCell,RestrictiveCell,UncrossableCell
public abstract class Cell extends java.lang.Object implements Element<java.lang.Integer>
A Cell in a grid. Atomic element of a MapLevel, used to render background textures.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description Coordinates<java.lang.Integer>getCoordinates()Coordinates of the element in the game.DimensiongetDimension()Return dimension of the Element.java.lang.StringgetName()Name getter of the elementSpritegetSprite()Returns sprite of the elementabstract booleanisCrossableBy(Entity entity)Checks if given entity can cross this cell.voidsetCoordinates(Coordinates<java.lang.Integer> coordinates)Allows setting new coordinates for the element.voidsetDimension(Dimension dimension)Allows to set dimension of the element, representing its size.voidsetSprite(Sprite sprite)Set sprite of an elementMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
dimension
-
coords
-
sprite
-
name
private java.lang.String name
-
-
Constructor Details
-
Cell
Default constructor. Set a case sprite and coordinates in the map.- Parameters:
x- the abscissa coordinate of the cell in the map. Coordinates values are integers.y- the ordinate coordinate of the cell in the map. Coordinates values are integers.sprite- the sprite to apply on the case
-
-
Method Details
-
getDimension
Description copied from interface:ElementReturn dimension of the Element. Represents the size of the Element.- Specified by:
getDimensionin interfaceElement<java.lang.Integer>- Returns:
- Dimension of the element
-
setDimension
Description copied from interface:ElementAllows to set dimension of the element, representing its size.- Specified by:
setDimensionin interfaceElement<java.lang.Integer>- Parameters:
dimension- Dimension to set
-
getSprite
Description copied from interface:ElementReturns sprite of the element -
setSprite
Description copied from interface:ElementSet sprite of an element -
getCoordinates
Description copied from interface:ElementCoordinates of the element in the game.- Specified by:
getCoordinatesin interfaceElement<java.lang.Integer>- Returns:
- Coordinates of the element
-
setCoordinates
Description copied from interface:ElementAllows setting new coordinates for the element.- Specified by:
setCoordinatesin interfaceElement<java.lang.Integer>- Parameters:
coordinates- new coordinates
-
getName
public java.lang.String getName()Description copied from interface:ElementName getter of the element -
isCrossableBy
Checks if given entity can cross this cell. If entity cannot cross cell, then it will be blocked.- Parameters:
entity- entity to check if he can cross- Returns:
- boolean true if given entity can cross the cell, false otherwise.
-