Class Entity
java.lang.Object
rekit.logic.gameelements.GameElement
rekit.logic.gameelements.entities.Entity
- All Implemented Interfaces:
Collidable
- Direct Known Subclasses:
Boss
,Enemy
,Pickup
,StateEntity
This class represents one of the most important
These are the moving GameElements, which can interact between each other, so as the
GameElement
-Type:These are the moving GameElements, which can interact between each other, so as the
Player
, Enemies
, Pickups
, etc.- Author:
- Dominik Fuchss, Angelo Aracri
-
Nested Class Summary
Nested classes/interfaces inherited from interface rekit.logic.Collidable
Collidable.Optional
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Timer
protected int
The amount of lives the Entity has.Fields inherited from class rekit.logic.gameelements.GameElement
deleteMe, deltaTime, team, visible
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDamage
(int damage) Optional reaction to a collision.void
collidedWithSolid
(Frame collision, Direction dir) This implementation will ensure that no entity is able to fall through the ground or into another Object.final int
getLives()
Getter for the current lifes of the GameElement.protected void
This method will calculate the next position of the Entity depending on the velocity.protected boolean
Returns if theGameElement
is currently supposed to be rendered or not.final void
Template method that will be called periodically after being added to aIScene
.final void
setLives
(int lives) Set current lives.Methods inherited from class rekit.logic.gameelements.GameElement
checkCollision, create, destroy, getDeleteMe, getFrame, getPos, getScene, getSize, getTeam, getVel, getZ, getZHint, init, internalRender, isAddableToGroup, killBoost, reactToCollision, render, setPos, setScene, setSize, setVel
-
Field Details
-
lives
protected int livesThe amount of lives the Entity has. Upon reaching 0 lives, he dies. -
invincibility
-
-
Constructor Details
-
Entity
Minimal Constructor byTeam
used for prototype constructors. The element will not be initialized- Parameters:
team
- the team
-
Entity
Constructor that initializes attributes and takes a start position.- Parameters:
startPos
- the position this entity shall be invel
- the velocitysize
- the sizeteam
- the team
-
-
Method Details
-
addDamage
public void addDamage(int damage) Description copied from interface:Collidable
Optional reaction to a collision. Removes lifes of the GameElement.- Parameters:
damage
- the amount of lifes to remove
-
setLives
public final void setLives(int lives) Set current lives.- Parameters:
lives
- the lives
-
getLives
public final int getLives()Description copied from interface:Collidable
Getter for the current lifes of the GameElement.- Returns:
- the amount of lifes of the GameElement
-
logicLoop
public final void logicLoop()Description copied from class:GameElement
Template method that will be called periodically after being added to a
IScene
.Should be overwritten in sub classes for implementing custom logic, physics emulation, time-based actions, ...
- Overrides:
logicLoop
in classGameElement
-
innerLogicLoop
protected void innerLogicLoop()This method will calculate the next position of the Entity depending on the velocity. -
collidedWithSolid
This implementation will ensure that no entity is able to fall through the ground or into another Object.- Parameters:
collision
- the Frame of the GameElement that was collided ondir
- the direction of this GameElement where the collision took place
-
isVisible
protected boolean isVisible()Description copied from class:GameElement
Returns if theGameElement
is currently supposed to be rendered or not.- Overrides:
isVisible
in classGameElement
- Returns:
- true if the
GameElement
should be rendered, false otherwise.
-