Package rekit.logic.gui.parallax
Class BackgroundElement
java.lang.Object
rekit.logic.gameelements.GameElement
rekit.logic.gui.parallax.BackgroundElement
- All Implemented Interfaces:
Collidable
- Direct Known Subclasses:
HeapElement
This is the parent class which all background elements shall extend.
-
Nested Class Summary
Nested classes/interfaces inherited from interface rekit.logic.Collidable
Collidable.Optional -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe z-pos of this element.protected ParallaxLayerThe parent parallax.Fields inherited from class rekit.logic.gameelements.GameElement
deleteMe, deltaTime, team, visible -
Constructor Summary
ConstructorsConstructorDescriptionBackgroundElement(ParallaxLayer parent, Vec pos) Create a BG-Element by parent and pos. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDamage(int damage) Optional reaction to a collision.voidcollidedWithSolid(Frame collision, Direction dir) Optional reaction to a collision that can be invoked in other GameElements reactToCollision().intgetLives()Getter for the current lifes of the GameElement.final IntegergetZHint()Methods inherited from class rekit.logic.gameelements.GameElement
checkCollision, create, destroy, getDeleteMe, getFrame, getPos, getScene, getSize, getTeam, getVel, getZ, init, internalRender, isAddableToGroup, isVisible, killBoost, logicLoop, reactToCollision, render, setPos, setScene, setSize, setVel
-
Field Details
-
parent
The parent parallax. -
backgroundZ
protected int backgroundZThe z-pos of this element.
-
-
Constructor Details
-
BackgroundElement
Create a BG-Element by parent and pos.- Parameters:
parent- the parentpos- the positon
-
-
Method Details
-
getZHint
Description copied from class:GameElement- Overrides:
getZHintin classGameElement- Returns:
nullif no hint, otherwise the expected position
-
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
-
getLives
public int getLives()Description copied from interface:CollidableGetter for the current lifes of the GameElement.- Returns:
- the amount of lifes of the GameElement
-
collidedWithSolid
Description copied from interface:CollidableOptional reaction to a collision that can be invoked in other GameElements reactToCollision(). Notification that this GameElement has collided with another GameElement with the CollisionFrame collision from a given direction dir. Define optional reactions that the GameElement performs on itself upon collision.- Parameters:
collision- the Frame of the GameElement that was collided ondir- the direction of this GameElement where the collision took place
-