Class Inanimate
- All Implemented Interfaces:
Collidable
- Direct Known Subclasses:
DynamicInanimate
,InanimateBox
,InanimateFloor
,InanimateTrigger
-
Nested Class Summary
Nested classes/interfaces inherited from interface rekit.logic.Collidable
Collidable.Optional
-
Field Summary
FieldsFields inherited from class rekit.logic.gameelements.GameElement
deleteMe, deltaTime, team, visible
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
collidedWithSolid
(Frame collision, Direction dir) Optional reaction to a collision that can be invoked in other GameElements reactToCollision().Stub Factory method that everyGameElement
must implement in order to being able to be instantiated dynamically by the level creation.int
getLives()
Getter for the current lifes of the GameElement.static Inanimate
Get the inanimate-prototype.void
Template method that will be called periodically after being added to aIScene
.void
reactToCollision
(GameElement element, Direction dir) Notification that this GameElement has been collided with from another GameElement element from the given direction dir.Methods inherited from class rekit.logic.gameelements.GameElement
checkCollision, destroy, getDeleteMe, getFrame, getPos, getScene, getSize, getTeam, getVel, getZ, getZHint, init, isAddableToGroup, isVisible, killBoost, logicLoop, render, setPos, setScene, setSize, setVel
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface rekit.logic.Collidable
addDamage
-
Field Details
-
color
The color.
-
-
Constructor Details
-
Inanimate
Create an inanimate.- Parameters:
pos
- the positionsize
- the sizecolor
- the colorteam
- the team
-
Inanimate
Create an inanimate.- Parameters:
pos
- the positionsize
- the sizecolor
- the color
-
-
Method Details
-
internalRender
Description copied from class:GameElement
Template method that will be called periodically after being added to a
IScene
. Must be as performant as possible to keep the FPS low, since it will be called in every render-loop.Should be overwritten in sub classes for custom visualization using the
GameGrid
.- Overrides:
internalRender
in classGameElement
- Parameters:
f
- theGameGrid
that represents the games field and supplies primitive drawing operations.
-
reactToCollision
Description copied from interface:Collidable
Notification that this GameElement has been collided with from another GameElement element from the given direction dir.
Can be overwritten for defining an optional reaction that the GameElement performs on the other GameElement and/or itself upon collision.
- Specified by:
reactToCollision
in interfaceCollidable
- Overrides:
reactToCollision
in classGameElement
- Parameters:
element
- the GameElement that collided with this GameElementdir
- the Direction this GameElement has been collided from.
-
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
-
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
-
create
Description copied from class:GameElement
Stub Factory method that every
GameElement
must implement in order to being able to be instantiated dynamically by the level creation.A startPos must be supplied to position the new GameElement right.
Also, an array of modifiers that the extending
GameElement
can define and use is supplied. These are used make level creation able to determine theGameElements
behavior. Note: the modifiers are not checked in syntax, so it must be thoroughly checked.- Overrides:
create
in classGameElement
- Parameters:
startPos
- the initial position of the newGameElement
.options
- optional parameters that may determine additional behavior of theGameElement
.- Returns:
- the newly created
GameElement
.
-
getPrototype
Get the inanimate-prototype.- Returns:
- the prototype
-