public abstract class AbstractEntity extends AbstractGameObject
GAME_DIAGLENGTH, GAME_DIAGLENGTH2, GAME_EDGELENGTH, GAME_EDGELENGTH2, OBJECTTYPESNUM, VALUESNUM, VIEW_DEPTH, VIEW_DEPTH2, VIEW_DEPTH4, VIEW_HEIGHT, VIEW_HEIGHT2, VIEW_HEIGHT4, VIEW_WIDTH, VIEW_WIDTH2, VIEW_WIDTH4, ZAXISSHORTENING
Modifier | Constructor and Description |
---|---|
protected |
AbstractEntity(byte id)
Create an abstractEntity.
|
Modifier and Type | Method and Description |
---|---|
void |
disableShadow() |
void |
dispose()
Deletes the object from the map and every other container.
|
void |
disposeFromMap()
Deletes the object from the map.
|
void |
enableShadow() |
EntityAnimation |
getAnimation()
Animation information.
|
char |
getCategory()
Get the category letter for accessing sprites.
|
int |
getDimensionZ() |
java.lang.String |
getName()
Returns the name of the object
|
Point |
getPosition()
Return the coordinates of the SelfAware object.
|
static java.util.HashMap<java.lang.String,java.lang.Class<? extends AbstractEntity>> |
getRegisteredEntities()
Get a map of the registered entities
|
boolean |
isGettingSaved()
Is the oject saved on the map?
|
boolean |
isInMemoryArea()
true if on chunk which is in memory
|
boolean |
isObstacle()
Is this object an obstacle or can you pass through?
|
boolean |
isOnGround()
Is the entity laying/standing on the ground?
|
boolean |
isTransparent()
Can light travel through object?
|
static void |
registerEngineEntities()
Registers engine entities in a map.
|
static void |
registerEntity(java.lang.String name,
java.lang.Class<? extends AbstractEntity> entityClass)
Register a class of entities.
|
void |
setAnimation(EntityAnimation animation)
Give the entity an animation.
|
void |
setDimensionZ(int dimensionZ)
Set the height of the object.
|
void |
setHeight(float height)
Deprecated.
v1.5.4
|
void |
setName(java.lang.String name) |
void |
setObstacle(boolean obstacle)
Make the object to an obstacle or passable.
|
void |
setPosition(AbstractPosition pos)
Set the coordinates without safety check.
|
void |
setSaveToDisk(boolean saveToDisk)
Temp objects should not be saved.
|
boolean |
shouldBeDisposed() |
boolean |
shouldBeDisposedFromMap() |
AbstractEntity |
spawn(Point point)
add this entity to the map-> let it spawn
|
boolean |
spawned()
Is the object active on the map?
|
void |
update(float dt)
Updates the logic of the object.
|
getAtlasRegion, getColor, getCoreData, getDepth, getDrawCalls, getHealth, getId, getLightlevel, getPixmap, getRotation, getScaling, getSprite, getSpriteId, getSprites, getSpritesheet, getSpritesheetPath, getTextureDiffuse, getTextureNormal, getValue, increaseDrawCalls, isHidden, loadSheet, render, render, render, render, resetDrawCalls, setColor, setCustomSpritesheet, setGraphicsId, setHealth, setHidden, setLightlevel, setRotation, setScaling, setValue, staticDispose
protected AbstractEntity(byte id)
id
- objects with id -1 are to deleted. 0 are invisible objectspublic static void registerEngineEntities()
public static void registerEntity(java.lang.String name, java.lang.Class<? extends AbstractEntity> entityClass)
name
- the name of the entitie. e.g. "Ball"entityClass
- the class you want to registerpublic static java.util.HashMap<java.lang.String,java.lang.Class<? extends AbstractEntity>> getRegisteredEntities()
public void update(float dt)
dt
- time since last updatepublic Point getPosition()
AbstractGameObject
getPosition
in class AbstractGameObject
public void setPosition(AbstractPosition pos)
AbstractGameObject
setPosition
in class AbstractGameObject
pos
- the coordinates you want to setpublic void setHeight(float height)
height
- public boolean isOnGround()
public AbstractEntity spawn(Point point)
point
- the point in the game world where the object ispublic void enableShadow()
public void disableShadow()
public boolean spawned()
public EntityAnimation getAnimation()
public void setAnimation(EntityAnimation animation)
animation
- public char getCategory()
AbstractGameObject
getCategory
in class AbstractGameObject
public java.lang.String getName()
AbstractGameObject
getName
in interface HasID
getName
in class AbstractGameObject
public void setName(java.lang.String name)
name
- public void setDimensionZ(int dimensionZ)
dimensionZ
- public int getDimensionZ()
getDimensionZ
in class AbstractGameObject
public void disposeFromMap()
shouldBeDisposed()
public void dispose()
shouldBeDisposed()
,
disposeFromMap()
public boolean shouldBeDisposed()
dispose()
public boolean shouldBeDisposedFromMap()
disposeFromMap()
,
shouldBeDisposed()
public boolean isGettingSaved()
public void setSaveToDisk(boolean saveToDisk)
saveToDisk
- new value of saveToDiskpublic boolean isInMemoryArea()
public void setObstacle(boolean obstacle)
obstacle
- true when obstacle. False when passable.public boolean isObstacle()
HasID
public boolean isTransparent()
HasID