Package dev.kyzel.game.entity.animal
Class Animal
java.lang.Object
dev.kyzel.game.entity.Entity
dev.kyzel.game.entity.animal.Animal
- All Implemented Interfaces:
IAttackable
The animal super class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe counter to see when the animal should do a different action (e.g.protected BufferedImageThe current animal's sprite.protected doubleThe hostile probability of the animal.protected intThe current index to use as the animal's sprite.private final intThe max counter for action change.Fields inherited from class dev.kyzel.game.entity.Entity
attackValue, basedSpeed, currentHealthValue, direction, game, healingCounter, hitTick, invincibleCounter, isCursed, knockbackCounter, maxHealingCounter, maxHealthValue, maxHitTick, maxInvincibleCounter, maxKnockbackCounter, previousDirection, render, solidArea, solidAreaDefaultX, solidAreaDefaultY, speed, spriteCounter, state, x, y -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDraws the entity.voidDraws the health bar of the entity.getAnimalDirection(double num) Gets aDirectionto move in depends on the given number from 0 to 1.abstract intgetPoint()Gets the points of the animal.voidmove(TileManager tileManager) Attempts to do an action with the animal (including moving, attacking something in the currentDirection).abstract voidSet the current animal's sprite.voidupdate()Updates the entity.Methods inherited from class dev.kyzel.game.entity.Entity
collideWithEntity, collideWithPlayer, collideWithTile, cursed, getAttackValue, getDirection, getGame, getHealthValue, getInvincibleCounter, getKnockbackCounter, getMaxHealthValue, getPreviousDirection, getRender, getSolidArea, getSolidAreaDefaultX, getSolidAreaDefaultY, getSpeed, getSwimmingSpeed, getX, getY, healing, increaseImageIndex, inflictDamage, initTexture, isAlive, isCursed, isDead, isInRange, knockback, setAttackValue, setDirection, setHealthValue, setInvincibleCounter, setKnockbackCounter, setMaxHealthValue, setPreviousDirection, setRender, setSpeed, setX, setY
-
Field Details
-
animalImage
The current animal's sprite. -
imageIndex
protected int imageIndexThe current index to use as the animal's sprite. -
hostileProb
protected double hostileProbThe hostile probability of the animal. -
actionCounter
private int actionCounterThe counter to see when the animal should do a different action (e.g. move in a different direction). -
maxActionCount
private final int maxActionCountThe max counter for action change.- See Also:
-
-
Constructor Details
-
Animal
Creates a new Animal. Construction of a new, plain Animal is not allowed. Construction has to be explicitly typed (e.g. Zombie, Slime,...).
-
-
Method Details
-
getAnimalDirection
Gets aDirectionto move in depends on the given number from 0 to 1.- Parameters:
num- the given number- Returns:
- the
Directionto move in
-
move
Attempts to do an action with the animal (including moving, attacking something in the currentDirection).- Parameters:
tileManager- theTileManagerof the game
-
update
public void update()Description copied from class:EntityUpdates the entity. -
setCurrentAnimalImage
public abstract void setCurrentAnimalImage()Set the current animal's sprite. -
getPoint
public abstract int getPoint()Gets the points of the animal.- Returns:
- the points of the animal
-
drawHealthBar
Description copied from class:EntityDraws the health bar of the entity.- Specified by:
drawHealthBarin classEntity- Parameters:
g- theGraphicswhich is used to draw
-
draw
Description copied from class:EntityDraws the entity.
-