Package com.dicycat.kroy.entities
Class Entity
- java.lang.Object
-
- com.dicycat.kroy.GameObject
-
- com.dicycat.kroy.entities.Entity
-
- Direct Known Subclasses:
FireStation
,FireTruck
,Fortress
,UFO
public abstract class Entity extends GameObject
Class for interactive gameObjects- Author:
- Riju De
-
-
Constructor Summary
Constructors Constructor Description Entity(com.badlogic.gdx.math.Vector2 spawnPos, com.badlogic.gdx.graphics.Texture img, com.badlogic.gdx.math.Vector2 imSize, int health)
-
Method Summary
Modifier and Type Method Description void
applyDamage(float damage)
Apply x amount of damage to the entityjava.lang.Integer
getHealthPoints()
java.lang.Boolean
isAlive()
Checks if the Entity still has health and is not marked for removalvoid
update()
Method is called every frame (If added to the gameobjects list in GameScreen)-
Methods inherited from class com.dicycat.kroy.GameObject
changePosition, die, getCentre, getHeight, getOriginX, getOriginY, getPosition, getRotation, getSprite, getTexture, getTextureHeight, getTextureWidth, getWidth, getX, getXScale, getY, getYScale, isDisplayable, isRemove, render, setPosition, setRemove, setRotation
-
-
-
-
Constructor Detail
-
Entity
public Entity(com.badlogic.gdx.math.Vector2 spawnPos, com.badlogic.gdx.graphics.Texture img, com.badlogic.gdx.math.Vector2 imSize, int health)
- Parameters:
spawnPos
- The position the entity will spawn at.img
- The texture of the entity.imSize
- Size of the entity. Can be used to resize large/small textureshealth
- Hit points of the entity
-
-
Method Detail
-
update
public void update()
Method is called every frame (If added to the gameobjects list in GameScreen)- Specified by:
update
in classGameObject
-
isAlive
public java.lang.Boolean isAlive()
Checks if the Entity still has health and is not marked for removal- Returns:
- alive Is health above 0 and is not marked for removal
-
applyDamage
public void applyDamage(float damage)
Apply x amount of damage to the entity- Parameters:
damage
- Amount of damage to inflict on the Entity
-
getHealthPoints
public java.lang.Integer getHealthPoints()
-
-