Package rekit.logic.gameelements.type
Class Coin
java.lang.Object
rekit.logic.gameelements.GameElement
rekit.logic.gameelements.entities.Entity
rekit.logic.gameelements.type.Pickup
rekit.logic.gameelements.type.Coin
- All Implemented Interfaces:
Collidable
- Direct Known Subclasses:
DefaultCoin
This class defines a simple
Pickup
; a Coin which will give the
player points.-
Nested Class Summary
Nested classes/interfaces inherited from interface rekit.logic.Collidable
Collidable.Optional
-
Field Summary
FieldsFields inherited from class rekit.logic.gameelements.entities.Entity
invincibility, lives
Fields inherited from class rekit.logic.gameelements.GameElement
deleteMe, deltaTime, team, visible
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Coin
Stub Factory method that everyGameElement
must implement in order to being able to be instantiated dynamically by the level creation.protected abstract RGBAColor
getColor()
Get the main color of the coin.protected abstract RGBAColor
Get a darker version of the colorgetColor()
for the edge of the coin.static final Set<? extends GameElement>
Get a set of coin prototypes.protected abstract int
getValue()
Get the value of the coin.protected void
This method will calculate the next position of the Entity depending on the velocity.void
Template method that will be called periodically after being added to aIScene
.void
perform
(GameElement collector) Template method that should be overwritten in concretePickups
to add the action that is performed upon being collected by the Player.Methods inherited from class rekit.logic.gameelements.type.Pickup
reactToCollision
Methods inherited from class rekit.logic.gameelements.entities.Entity
addDamage, collidedWithSolid, getLives, isVisible, logicLoop, setLives
Methods inherited from class rekit.logic.gameelements.GameElement
checkCollision, destroy, getDeleteMe, getFrame, getPos, getScene, getSize, getTeam, getVel, getZ, getZHint, init, isAddableToGroup, killBoost, render, setPos, setScene, setSize, setVel
-
Field Details
-
SIN
protected static double SINThe global SIN value for coins.
-
-
Constructor Details
-
Coin
protected Coin()Prototype Constructor. -
Coin
Instantiate a Coin by position.- Parameters:
startPos
- the start position
-
-
Method Details
-
getPrototypes
Get a set of coin prototypes.- Returns:
- a set of prototypes
-
perform
Description copied from class:Pickup
Template method that should be overwritten in concretePickups
to add the action that is performed upon being collected by the Player. -
innerLogicLoop
protected void innerLogicLoop()Description copied from class:Entity
This method will calculate the next position of the Entity depending on the velocity.- Overrides:
innerLogicLoop
in classPickup
-
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.
-
getColor
Get the main color of the coin.- Returns:
- the main color
-
getDarkerColor
Get a darker version of the colorgetColor()
for the edge of the coin.- Returns:
- the darker color
-
getValue
protected abstract int getValue()Get the value of the coin.- Returns:
- the value
-
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.- Specified by:
create
in classPickup
- Parameters:
startPos
- the initial position of the newGameElement
.options
- optional parameters that may determine additional behavior of theGameElement
.- Returns:
- the newly created
GameElement
.
-