Package com.starpoints.game
Class PlayerFigure
- java.lang.Object
-
- com.starpoints.game.Thing
-
- com.starpoints.game.Figure
-
- com.starpoints.game.PlayerFigure
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class PlayerFigure extends Figure
Superclass for player figures. The PlayerFigures settings (image, colors, energy and ram power etc.) are specified in the SP_Players.ini-file. The Players moves are handled directly by the game. Bonus counts and coolness calculation is implemented in the PlayerFigures win()-method. Some modifications for energy losses depending on the difficulty level are done by the PlayerFigure as well.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringbestLevelThe best levels name.protected intbestPointsBest levels point resultbooleanlistenerFlag, if figure is already registered as key listener.protected SkinskinThe PlayerFigures skin for initial settings.-
Fields inherited from class com.starpoints.game.Figure
ABSMAXENERGY, affectsBlue, alreadyKilled, colorlistener, DEFAULT_FIGURE_PAINTERCLASS, dieListener, dieReason, DOWN, energylistener, heatLevel, heatlistener, hoverCount, hoverHeight, hoverlistener, imageName, initialEnergy, INITIALRAMPOWER, isRocketTarget, item, itemlistener, killer, LEFT, lives, MAXHOVERHEIGHT, maxRadius, MAXSLOTS, money, moved, movelistener, name, NONE, number, oldItem, oldRocketXP, oldRocketYP, PANIC, penalty, permItems, pointBonus, pointlistener, points, ramlistener, ramPower, RIGHT, side, sinker, slots, speedCount, STEPLEFT, STEPRIGHT, stunCount, stunlistener, sumPoints, UP, USE_ITEM, viewDir, visibilitylistener, visibleCount, wantsToUseItem, winCounter
-
Fields inherited from class com.starpoints.game.Thing
energy, energyFx, energyMaxSoundPlayed, energyModifications, explosionCounter, game, innerColor, invulnCount, isAffectedByBlack, isAffectedByGray, level, MAX_TEXTPAINT, maxEnergy, nextID, outerColor, p, shieldCount, status, text
-
-
Constructor Summary
Constructors Constructor Description PlayerFigure(Game game, FigureInfo fi)Creates a new PlayerFigure
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAdditionalEquipment(java.lang.String equipment)Adds an additional equipment.voidapplySkin(Skin skin)Applies the given skin to this PlayerFigure, so the skins settings are used for this figure.ThingStatecreateState(AnimationInfo animation)Creates a state object for this item.voiddoSpecialUpdate(AnimationInfo animation)Special updates.java.util.List<java.lang.String>getAdditionalEquipment()java.lang.StringgetBestLevel()Gets the best level of the current game.intgetBestPoints()Gets the best levels score of the current game.protected java.lang.StringgetDyingClip()Gets the sound clip to be played if figure dies.protected java.lang.StringgetExplosionClip()Gets a clip that is played if this figure stands in an explosion.SkingetSkin()Returns this figures skin.DirectiongetViewDirection()Gets the current view direction.booleanhasAdditionalEquipment(java.lang.String equipment)Checks, if figure has an additional equipment.booleanisDummy()Checks, if figure is a dummy.booleanisParticipatingInGame()protected intonAddHeat(int heat, boolean internal, Thing source)Called when heat is added.protected booleanonBeforeDie(Thing source, DieReason reason, AnimationInfo animation)Called before the figure dies (after event handling in FigureKillListeners).protected intonBeforeRemoveEnergy(int min, Thing source, DieReason reason, AnimationInfo animation)Called before energy is removed from figure.voidreInit(Field f)Reinitializes the player figure.voidremoveAdditionalEquipment(java.lang.String equipment)Removes an additional equipment.voidrotateLeft()Rotates the view direction counterclockwise.voidrotateRight()Rotates the view direction clockwise.voidsetInitialEnergy(int initialEnergy)Sets the initial energy when starting a new level.voidsetMaxEnergy(int maxEnergy)Sets a new energy maximum.voidsetParticipatingInGame(boolean isParticipatingInGame)voidsetViewDirection(Direction viewDir)Sets a new view direction.protected voidupdatePoints()Inserts sound and message for penalties.intwin(int roundCount)This effect is performed when the figure won a game.-
Methods inherited from class com.starpoints.game.Figure
addEnergy, addFigureColorListener, addFigureEnergyListener, addFigureHeatListener, addFigureHoverListener, addFigureItemListener, addFigureKillListener, addFigureMoveListener, addFigurePointListener, addFigureRamListener, addFigureStunListener, addFigureVisibilityListener, addHeat, addInitialEnergy, addLife, addMaxEnergy, addMoney, addPenalty, addPermanentItem, addPoints, addSlots, affectsBlue, beforeMove, beRammed, determineIQ, determineIQ, die, doCalculateNextPoint, drawState, entersColor, fireColorEnterEvent, fireColorStayEvent, fireDieEvent, fireEnergyChangeEvent, fireEnergyLossEvent, fireGainPermanentItemEvent, fireHeatChangeEvent, fireHoverEvent, fireKillsEnemy, fireLoseItemEvent, fireLosePermanentItemEvent, fireLostPermanentItemEvent, fireMoveEvent, firePickesUpBombEvent, firePickesUpExplosiveEvent, firePickesUpItemEvent, firePointsChangeEvent, firePointSumChangeEvent, fireRamEvent, fireRamPowerEvent, fireSlotsChangeEvent, fireStunEvent, fireUseItemEvent, fireVisibilityChangesEvent, getDieReason, getFreeSlots, getHeatLevel, getHoverHeight, getHoverRounds, getImageName, getInitialEnergy, getInvisibilityRounds, getIq, getItem, getKillBonus, getLifes, getMaxSlots, getMoney, getName, getNumber, getPainterClassname, getPermanentItems, getPoints, getPointSum, getRamPower, getSlots, getSpeed, getStunCount, getWinCount, hasMoved, hasPermanentItem, hasPermanentItem, hover, increasePointSum, invulnerable, isAffectedByBlack, isAffectedByGray, isApplyingLevelInfoIQ, isApplyingLevelInfoSpeed, isAvailableInEditor, isDrawingNumber, isHovering, isRocketTarget, isSinking, isStunned, isVisible, loseItem, losePermanentItem, losePermanentItem, losePermanentItemInternal, onAfterDeath, onEnemyKilled, onExplode, onRoundBegin, playDyingSound, removeEnergy, removeFigureColorListener, removeFigureEnergyListener, removeFigureHeatListener, removeFigureHoverListener, removeFigureItemListener, removeFigureKillListener, removeFigureMoveListener, removeFigurePointListener, removeFigureRamListener, removeFigureStunListener, removeFigureVisibilityListener, removeMoney, removePoints, retrieveNextPoint, sellPermanentItem, setHoverCount, setHoverHeight, setInvisible, setIq, setIsRocketTarget, setItem, setMoney, setName, setNumber, setPoint, setSlots, setSpeed, setVisible, sink, staysOnColor, stopHover, stopSink, stun, takeItem, toString, updateExplodingStatus, updateThing, useItem, wantsToUseItem
-
Methods inherited from class com.starpoints.game.Thing
addShielding, addStateProperties, clearTexts, displayText, displayText, equals, getColor, getEnergy, getEnergyMaxCount, getExplosionCounter, getField, getGame, getID, getInnerColor, getInvulnerableRounds, getLevel, getMaxEnergy, getNextID, getOuterColor, getPoint, getShadowColor, getShield, getStateObject, getStatus, getText, getTextColor, getTextPaintCount, getX, getY, hashCode, isDestroyed, isExploding, isInvulnerable, isOK, isShowingEnergyFx, retrieveState, setEnergy, setEnergyMaxCount, setGame, setStatus, stepText, updateEnergy
-
-
-
-
Field Detail
-
listener
public boolean listener
Flag, if figure is already registered as key listener.
-
bestPoints
protected int bestPoints
Best levels point result
-
bestLevel
protected java.lang.String bestLevel
The best levels name.
-
skin
protected Skin skin
The PlayerFigures skin for initial settings. Used for determining base shieldings.
-
-
Constructor Detail
-
PlayerFigure
public PlayerFigure(Game game, FigureInfo fi)
Creates a new PlayerFigure- Parameters:
game- The game.fi- The FigureInfo.
-
-
Method Detail
-
applySkin
public void applySkin(Skin skin)
Applies the given skin to this PlayerFigure, so the skins settings are used for this figure.- Parameters:
skin- The skin.
-
onBeforeDie
protected boolean onBeforeDie(Thing source, DieReason reason, AnimationInfo animation)
Called before the figure dies (after event handling in FigureKillListeners). Calls Controller to vibrate.- Overrides:
onBeforeDiein classFigure- Parameters:
source- The death source.reason- The death reason.animation- The AnimationInfo- Returns:
- true.
-
win
public final int win(int roundCount)
This effect is performed when the figure won a game. Stores the level, if this was the best level yet.
-
onBeforeRemoveEnergy
protected int onBeforeRemoveEnergy(int min, Thing source, DieReason reason, AnimationInfo animation)Called before energy is removed from figure. Modifies the energy by the difficulty level.- Overrides:
onBeforeRemoveEnergyin classFigure- Parameters:
min- The energy loss.source- The source of the loss.reason- The reason.animation- The AnimationInfo.- Returns:
- A reduced energy by 20% in easy mode, increased by 20% in hard mode.
-
onAddHeat
protected int onAddHeat(int heat, boolean internal, Thing source)Called when heat is added. Reduces heat gain by skins heat shielding.
-
reInit
public void reInit(Field f)
Reinitializes the player figure. Resets the moving and sight direction, clears all bonus lists and flags etc.
-
updatePoints
protected void updatePoints()
Inserts sound and message for penalties.- Overrides:
updatePointsin classFigure
-
setMaxEnergy
public final void setMaxEnergy(int maxEnergy)
Sets a new energy maximum.- Overrides:
setMaxEnergyin classFigure- Parameters:
maxEnergy- The new max energy.
-
setInitialEnergy
public final void setInitialEnergy(int initialEnergy)
Sets the initial energy when starting a new level. If the initial energy is higher then the current max energy, this is also increased.- Overrides:
setInitialEnergyin classFigure- Parameters:
initialEnergy- The new initial energy when starting a new level
-
doSpecialUpdate
public void doSpecialUpdate(AnimationInfo animation)
Special updates. Updates some coolness counters.- Overrides:
doSpecialUpdatein classFigure- Parameters:
animation- The AnimationInfo.
-
isDummy
public boolean isDummy()
Checks, if figure is a dummy.
-
getExplosionClip
protected java.lang.String getExplosionClip()
Gets a clip that is played if this figure stands in an explosion.- Overrides:
getExplosionClipin classFigure- Returns:
- "explosion_ownfigure"
-
getDyingClip
protected java.lang.String getDyingClip()
Gets the sound clip to be played if figure dies.- Overrides:
getDyingClipin classFigure- Returns:
- "figure_die"
-
getBestLevel
public java.lang.String getBestLevel()
Gets the best level of the current game.- Returns:
- the bestLevel
-
getBestPoints
public int getBestPoints()
Gets the best levels score of the current game.- Returns:
- the bestPoints
-
getSkin
public Skin getSkin()
Returns this figures skin. Use return value for modifying or getting base shield settings or coolnessFactor. To set ram power or energy, use applySkin()-method instead.- Returns:
- The skin.
-
createState
public ThingState createState(AnimationInfo animation)
Creates a state object for this item.- Overrides:
createStatein classFigure
-
isParticipatingInGame
public boolean isParticipatingInGame()
- Returns:
- the isParticipatingInGame
-
setParticipatingInGame
public void setParticipatingInGame(boolean isParticipatingInGame)
- Parameters:
isParticipatingInGame- the isParticipatingInGame to set
-
getViewDirection
public Direction getViewDirection()
Gets the current view direction.- Returns:
- The viewDir
-
setViewDirection
public void setViewDirection(Direction viewDir)
Sets a new view direction.- Parameters:
viewDir- The viewDir to set
-
getAdditionalEquipment
public java.util.List<java.lang.String> getAdditionalEquipment()
- Returns:
- the additional equipments.
-
addAdditionalEquipment
public void addAdditionalEquipment(java.lang.String equipment)
Adds an additional equipment. Additional equipment can be used for game extensions and is not used in core game (yet). Additional equipment is not using up any inventory slots. Examples are Map and HeadUp Display in 3D game.- Parameters:
equipment- the equipment to add.
-
removeAdditionalEquipment
public void removeAdditionalEquipment(java.lang.String equipment)
Removes an additional equipment.- Parameters:
equipment- the equipment to remove.
-
hasAdditionalEquipment
public boolean hasAdditionalEquipment(java.lang.String equipment)
Checks, if figure has an additional equipment.- Parameters:
equipment- the equipment to check.- Returns:
- true, if figure has the additional equipment.
-
rotateLeft
public void rotateLeft()
Rotates the view direction counterclockwise.
-
rotateRight
public void rotateRight()
Rotates the view direction clockwise.
-
-