Package rekit.logic.gameelements.type
Class Pickup
java.lang.Object
rekit.logic.gameelements.GameElement
rekit.logic.gameelements.entities.Entity
rekit.logic.gameelements.type.Pickup
- All Implemented Interfaces:
Collidable
This class is the parent class of all Pickups in the game.
-
Nested Class Summary
Nested classes/interfaces inherited from interface rekit.logic.Collidable
Collidable.Optional -
Field Summary
Fields inherited from class rekit.logic.gameelements.entities.Entity
invincibility, livesFields inherited from class rekit.logic.gameelements.GameElement
deleteMe, deltaTime, team, visible -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract PickupStub Factory method that everyGameElementmust implement in order to being able to be instantiated dynamically by the level creation.static Set<? extends GameElement>Load all Pickups.protected voidThis method will calculate the next position of the Entity depending on the velocity.abstract voidperform(GameElement collector) Template method that should be overwritten in concretePickupsto add the action that is performed upon being collected by the Player.final voidreactToCollision(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.entities.Entity
addDamage, collidedWithSolid, getLives, isVisible, logicLoop, setLivesMethods inherited from class rekit.logic.gameelements.GameElement
checkCollision, destroy, getDeleteMe, getFrame, getPos, getScene, getSize, getTeam, getVel, getZ, getZHint, init, internalRender, isAddableToGroup, killBoost, render, setPos, setScene, setSize, setVel
-
Constructor Details
-
Pickup
protected Pickup()Prototype constructor. -
Pickup
Create a pickup.- Parameters:
startPos- the start posvel- the start velocitysize- the size
-
-
Method Details
-
getPrototypes
Load all Pickups.- Returns:
- a set of pickups
- See Also:
-
create
Description copied from class:GameElementStub Factory method that every
GameElementmust 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
GameElementcan define and use is supplied. These are used make level creation able to determine theGameElementsbehavior. Note: the modifiers are not checked in syntax, so it must be thoroughly checked.- Overrides:
createin classGameElement- Parameters:
startPos- the initial position of the newGameElement.options- optional parameters that may determine additional behavior of theGameElement.- Returns:
- the newly created
GameElement.
-
perform
Template method that should be overwritten in concretePickupsto add the action that is performed upon being collected by the Player.- Parameters:
collector- the GameElement which collects this Pickup
-
reactToCollision
Description copied from interface:CollidableNotification 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:
reactToCollisionin interfaceCollidable- Overrides:
reactToCollisionin classGameElement- Parameters:
element- the GameElement that collided with this GameElementdir- the Direction this GameElement has been collided from.
-
innerLogicLoop
protected void innerLogicLoop()Description copied from class:EntityThis method will calculate the next position of the Entity depending on the velocity.- Overrides:
innerLogicLoopin classEntity
-