Class Prop
java.lang.Object
de.gurkenlabs.litiengine.entities.Entity
de.gurkenlabs.litiengine.entities.CollisionEntity
de.gurkenlabs.litiengine.entities.CombatEntity
de.gurkenlabs.litiengine.entities.Prop
- All Implemented Interfaces:
EntityRenderedListener, EntityRenderListener, ICollisionEntity, ICombatEntity, IEntity, Tweenable, EventListener
A static/destructible scenery entity rendered from a sprite. Props extend
CombatEntity so they can take damage and be destroyed, and
support optional shadow rendering, sprite flipping/rotation and quality-based scaling.-
Field Summary
Fields inherited from class CombatEntity
DEFAULT_HITPOINTSFields inherited from class Entity
ANY_MESSAGE -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a newPropentity.Instantiates a newPropentity.Instantiates a newPropentity.Instantiates a newPropentity.Instantiates a newPropentity. -
Method Summary
Modifier and TypeMethodDescriptionprotected IEntityAnimationController<?> Creates the animation controller used to render this prop.booleanReturns whether this prop's sprite is flipped horizontally.booleanReturns whether this prop's sprite is flipped vertically.Gets the material of this prop.Gets the sprite rotation applied to this prop.Gets the name of the spritesheet used to render this prop.getState()Gets the state.booleanReturns whether this prop should cast a shadow.booleanisDead()Checks if is dead.booleanReturns whether this prop's sprite is scaled to its bounding box.voidsetAddShadow(boolean addShadow) Sets whether this prop should cast a shadow.voidsetFlipHorizontally(boolean flipHorizontally) Sets whether this prop's sprite is flipped horizontally.voidsetFlipVertically(boolean flipVertically) Sets whether this prop's sprite is flipped vertically.voidsetMaterial(Material material) Sets the material of this prop.voidsetScaling(boolean scaling) Sets whether this prop's sprite should be scaled to its bounding box.voidsetSpriteRotation(Rotation spriteRotation) Sets the sprite rotation applied to this prop.voidsetSpritesheetName(String spriteName) Sets the name of the spritesheet used to render this prop and updates the animation controller.toString()Methods inherited from class CombatEntity
addCombatEntityListener, die, fireDeathEvent, getAppliedEffects, getHitBox, getHitPoints, getTarget, getTeam, getTweenValues, hit, hit, isFriendly, isIndestructible, isNeutral, onDeath, onHit, onResurrect, removeCombatEntityListener, removeListener, removeListener, removeListener, resurrect, setIndestructible, setTarget, setTeam, setTweenValues, wasHitMethods inherited from class CollisionEntity
canCollideWith, fireCollisionEvent, getCollisionBox, getCollisionBox, getCollisionBox, getCollisionBoxAlign, getCollisionBoxCenter, getCollisionBoxHeight, getCollisionBoxValign, getCollisionBoxWidth, getCollisionType, hasCollision, onCollision, refreshCollisionBox, removeCollisionListener, setCollision, setCollisionBoxAlign, setCollisionBoxHeight, setCollisionBoxValign, setCollisionBoxWidth, setCollisionType, setHeight, setLocation, setSize, setWidthMethods inherited from class Entity
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, canRender, detachControllers, getAngle, getBoundingBox, getCenter, getController, getControllers, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onActionPerformed, onMessage, onMessage, onRendered, perform, register, removeActionPerformedListener, removed, removeListener, removeListener, removeListener, removeListener, removeListener, removeTag, rendered, rendering, renderWithLayer, sendMessage, setAngle, setController, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setVisible, setX, setYMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ICollisionEntity
canCollideWith, fireCollisionEvent, getCollisionBox, getCollisionBox, getCollisionBoxAlign, getCollisionBoxCenter, getCollisionBoxHeight, getCollisionBoxValign, getCollisionBoxWidth, getCollisionType, hasCollision, onCollision, removeCollisionListener, setCollision, setCollisionBoxAlign, setCollisionBoxHeight, setCollisionBoxValign, setCollisionBoxWidth, setCollisionTypeMethods inherited from interface IEntity
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, detachControllers, getAngle, getBoundingBox, getCenter, getController, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onActionPerformed, onMessage, onMessage, onRendered, perform, register, removeActionPerformedListener, removed, removeListener, removeListener, removeListener, removeListener, removeListener, removeTag, renderWithLayer, scripts, sendMessage, setAngle, setController, setHeight, setLocation, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setSize, setVisible, setWidth, setX, setY
-
Constructor Details
-
Prop
Instantiates a newPropentity.- Parameters:
spritesheetName- The spritesheet name of this prop.
-
Prop
Instantiates a newPropentity.- Parameters:
x- The x-coordinate of this prop.y- The y-coordinate of this prop.spritesheetName- The spritesheet name of this prop.
-
Prop
-
Prop
-
Prop
-
-
Method Details
-
getMaterial
-
getSpritesheetName
Gets the name of the spritesheet used to render this prop.- Returns:
- the spritesheet name
-
getState
-
isAddShadow
public boolean isAddShadow()Returns whether this prop should cast a shadow.- Returns:
trueif a shadow is rendered
-
isScaling
public boolean isScaling()Returns whether this prop's sprite is scaled to its bounding box.- Returns:
trueif scaling is enabled
-
flipHorizontally
public boolean flipHorizontally()Returns whether this prop's sprite is flipped horizontally.- Returns:
trueif flipped horizontally
-
flipVertically
public boolean flipVertically()Returns whether this prop's sprite is flipped vertically.- Returns:
trueif flipped vertically
-
getSpriteRotation
Gets the sprite rotation applied to this prop.- Returns:
- the sprite rotation
-
setMaterial
Sets the material of this prop.- Parameters:
material- the material to set
-
setSpritesheetName
Sets the name of the spritesheet used to render this prop and updates the animation controller.- Parameters:
spriteName- the new spritesheet name
-
setAddShadow
public void setAddShadow(boolean addShadow) Sets whether this prop should cast a shadow.- Parameters:
addShadow-trueto render a shadow
-
setScaling
public void setScaling(boolean scaling) Sets whether this prop's sprite should be scaled to its bounding box.- Parameters:
scaling-trueto enable scaling
-
isDead
public boolean isDead()Description copied from class:CombatEntityChecks if is dead.- Specified by:
isDeadin interfaceICombatEntity- Overrides:
isDeadin classCombatEntity- Returns:
- true, if is dead
-
setSpriteRotation
Sets the sprite rotation applied to this prop.- Parameters:
spriteRotation- the rotation to set
-
setFlipHorizontally
public void setFlipHorizontally(boolean flipHorizontally) Sets whether this prop's sprite is flipped horizontally.- Parameters:
flipHorizontally-trueto flip horizontally
-
setFlipVertically
public void setFlipVertically(boolean flipVertically) Sets whether this prop's sprite is flipped vertically.- Parameters:
flipVertically-trueto flip vertically
-
toString
-
createAnimationController
Creates the animation controller used to render this prop. Subclasses may override this method to provide a custom controller implementation.- Returns:
- the new animation controller
-