Package com.starpoints.game.figure
Class LaserTower
- java.lang.Object
-
- com.starpoints.game.Thing
-
- com.starpoints.game.Figure
-
- com.starpoints.game.ComputerFigure
-
- com.starpoints.game.figure.LaserTower
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
SuperLaserTower
public class LaserTower extends ComputerFigure
Enemy that fires lasers but does not move.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
counter
Fire counter for laser beam.protected int
FIRE_DELAY
Laser fire delay between aiming and firing.protected int
FIRE_FREQUENCY
Laser fire frequency.protected boolean
isFiring
Flag for laser beam.-
Fields inherited from class com.starpoints.game.ComputerFigure
pointList, speedCount, wantsToEnterBlue
-
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, 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 LaserTower(Game game, FigureInfo figureInfo)
Creates a new LaserTower.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addStateProperties(ThingState state, AnimationInfo animation)
Adds properties necessary for LaserTower painting.protected boolean
checkEnemy(Figure f)
Checks, if a figure is relevant for the closest enemy determination.protected void
doSpecialUpdate(AnimationInfo animation)
This method is called at the end of the regular updateThing()-method.protected java.lang.String
getBeamSound()
Gets the sound to play when aiming.protected java.lang.String
getFireSound()
Gets the sound to play when firing laser.java.lang.String
getPainterClassname()
Gets the fully qualified classname of the Painter to use for this item (in 2D game).Point
getTarget()
Gets the current target (or null, if not aiming).boolean
isFiring()
Checks, if the laser tower is currently firing.protected void
performLaserEffect(Thing target, AnimationInfo animation)
Performs the laser hit effect.protected void
reInit(Field f)
Reinitializes the figure after each level.protected boolean
wantsToMove()
Checks, if this figure wants to move.-
Methods inherited from class com.starpoints.game.ComputerFigure
calculateItemRating, calculateNextPoint, calculatePointRating, doCalculateNextPoint, entersExplosion, findClosestEnemy, getDistance, getDistance, getIq, isApplyingLevelInfoIQ, isDummy, isForbiddenItem, isRamTarget, isUnwantedItem, isVisible, modifyByColor
-
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, createState, determineIQ, determineIQ, die, 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, getDyingClip, getExplosionClip, getFreeSlots, getHeatLevel, getHoverHeight, getHoverRounds, getImageName, getInitialEnergy, getInvisibilityRounds, getItem, getKillBonus, getLifes, getMaxSlots, getMoney, getName, getNumber, getPermanentItems, getPoints, getPointSum, getRamPower, getSlots, getSpeed, getStunCount, getWinCount, hasMoved, hasPermanentItem, hasPermanentItem, hover, increasePointSum, invulnerable, isAffectedByBlack, isAffectedByGray, isApplyingLevelInfoSpeed, isAvailableInEditor, isDrawingNumber, isHovering, isRocketTarget, isSinking, isStunned, isVisible, loseItem, losePermanentItem, losePermanentItem, losePermanentItemInternal, onAddHeat, onAfterDeath, onBeforeDie, onBeforeRemoveEnergy, onEnemyKilled, onExplode, onRoundBegin, playDyingSound, removeEnergy, removeFigureColorListener, removeFigureEnergyListener, removeFigureHeatListener, removeFigureHoverListener, removeFigureItemListener, removeFigureKillListener, removeFigureMoveListener, removeFigurePointListener, removeFigureRamListener, removeFigureStunListener, removeFigureVisibilityListener, removeMoney, removePoints, retrieveNextPoint, sellPermanentItem, setHoverCount, setHoverHeight, setInitialEnergy, setInvisible, setIq, setIsRocketTarget, setItem, setMaxEnergy, setMoney, setName, setNumber, setPoint, setSlots, setSpeed, setVisible, sink, staysOnColor, stopHover, stopSink, stun, takeItem, toString, updateExplodingStatus, updatePoints, updateThing, useItem, wantsToUseItem, win
-
Methods inherited from class com.starpoints.game.Thing
addShielding, 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
-
-
-
-
Constructor Detail
-
LaserTower
public LaserTower(Game game, FigureInfo figureInfo)
Creates a new LaserTower.- Parameters:
game
- The game.figureInfo
- The figure info.
-
-
Method Detail
-
addStateProperties
protected void addStateProperties(ThingState state, AnimationInfo animation)
Adds properties necessary for LaserTower painting.- Overrides:
addStateProperties
in classThing
- Parameters:
state
- The state to add properties to.animation
- The current AnimationInfo.
-
getPainterClassname
public java.lang.String getPainterClassname()
Gets the fully qualified classname of the Painter to use for this item (in 2D game).- Overrides:
getPainterClassname
in classFigure
- Returns:
- "com.starpoints.painter.arena2D.PainterLaserTower"
-
doSpecialUpdate
protected void doSpecialUpdate(AnimationInfo animation)
This method is called at the end of the regular updateThing()-method. If the number of rounds equal to the fire frequency has passed, since the last laser was fired, the figure aims its laser.- Overrides:
doSpecialUpdate
in classComputerFigure
- Parameters:
animation
- The AnimationInfo.
-
getBeamSound
protected java.lang.String getBeamSound()
Gets the sound to play when aiming.- Returns:
- "laseraim"
-
checkEnemy
protected boolean checkEnemy(Figure f)
Checks, if a figure is relevant for the closest enemy determination.- Overrides:
checkEnemy
in classComputerFigure
- Parameters:
f
- The figure.- Returns:
- true, if figure is not another ChaosDuck AND super.checkEnemy().
-
performLaserEffect
protected void performLaserEffect(Thing target, AnimationInfo animation)
Performs the laser hit effect.- Parameters:
target
- The target. Never null.animation
- The AnimationInfo.
-
getFireSound
protected java.lang.String getFireSound()
Gets the sound to play when firing laser.- Returns:
- "laserbeam"
-
getTarget
public Point getTarget()
Gets the current target (or null, if not aiming).- Returns:
- The target.
-
isFiring
public boolean isFiring()
Checks, if the laser tower is currently firing.- Returns:
- true, if Tower is firing its laser.
-
wantsToMove
protected boolean wantsToMove()
Checks, if this figure wants to move.- Overrides:
wantsToMove
in classComputerFigure
- Returns:
- false.
-
-