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 Timerprotected intThe 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 TypeMethodDescriptionvoidaddDamage(int damage) Optional reaction to a collision.voidcollidedWithSolid(Frame collision, Direction dir) This implementation will ensure that no entity is able to fall through the ground or into another Object.final intgetLives()Getter for the current lifes of the GameElement.protected voidThis method will calculate the next position of the Entity depending on the velocity.protected booleanReturns if theGameElementis currently supposed to be rendered or not.final voidTemplate method that will be called periodically after being added to aIScene.final voidsetLives(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 byTeamused 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:CollidableOptional 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:CollidableGetter for the current lifes of the GameElement.- Returns:
- the amount of lifes of the GameElement
-
logicLoop
public final void logicLoop()Description copied from class:GameElementTemplate 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:
logicLoopin 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:GameElementReturns if theGameElementis currently supposed to be rendered or not.- Overrides:
isVisiblein classGameElement- Returns:
- true if the
GameElementshould be rendered, false otherwise.
-