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 int
The z-pos of this element.protected ParallaxLayer
The 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 TypeMethodDescriptionvoid
addDamage
(int damage) Optional reaction to a collision.void
collidedWithSolid
(Frame collision, Direction dir) Optional reaction to a collision that can be invoked in other GameElements reactToCollision().int
getLives()
Getter for the current lifes of the GameElement.final Integer
getZHint()
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:
getZHint
in classGameElement
- Returns:
null
if no hint, otherwise the expected position
-
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
-
getLives
public int getLives()Description copied from interface:Collidable
Getter for the current lifes of the GameElement.- Returns:
- the amount of lifes of the GameElement
-
collidedWithSolid
Description copied from interface:Collidable
Optional 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
-