public class Tree extends InteractiveObject
InteractiveObject.InteractiveState
Modifier and Type | Field and Description |
---|---|
static float |
COLLIDER_HEIGHT
Stores the width and height of a tree's rectangle collider in world units.
|
static float |
COLLIDER_WIDTH
Stores the width and height of a tree's rectangle collider in world units.
|
static float |
DEFAULT_HEALTH
Stores the default health of the tree.
|
Constructor and Description |
---|
Tree()
Creates a tree whose bottom-center is at position (0, 0).
|
Tree(float x,
float y)
Creates a tree whose bottom-center is at position (x, y).
|
Modifier and Type | Method and Description |
---|---|
float |
getHealth()
Gets the tree's health.
|
void |
reset()
Called whenever this tree GameObject has been pushed back into a pool.
|
void |
scavenged()
Called when the tree's health has been depleted to zero and has been scavenged.
|
void |
setHealth(float health)
Sets the tree's health.
|
void |
takeDamage(float damage)
Deals damage to the tree by removing the given amount from its health.
|
void |
update(float deltaTime)
Updates the tree every frame.
|
canTarget, getInteractiveState, getItemProbabilityMap, setInteractiveState, setItemProbabilityMap, targetted, untargetted
getAcceleration, getCollider, getObjectId, getPosition, getPreviousPosition, getSkeleton, getStateTime, getTerrainCell, getVelocity, getX, getY, isAbove, moveTo, setAcceleration, setCollider, setObjectId, setPosition, setSkeleton, setStateTime, setTerrainCell, setVelocity, setVelocityX, setVelocityY, setX, setY, updateCollider, updatePosition
public static final float COLLIDER_WIDTH
public static final float COLLIDER_HEIGHT
public static final float DEFAULT_HEALTH
public Tree()
public Tree(float x, float y)
public void update(float deltaTime)
update
in class InteractiveObject
public void reset()
reset
in interface com.badlogic.gdx.utils.Pool.Poolable
reset
in class InteractiveObject
public void takeDamage(float damage)
public void scavenged()
scavenged
in class InteractiveObject
public float getHealth()
public void setHealth(float health)