javoids
Class Bullet

java.lang.Object
  extended by javoids.BasicSprite
      extended by javoids.Sprite
          extended by javoids.ShieldedSprite
              extended by javoids.Bullet
All Implemented Interfaces:
java.io.Serializable, Sizes

public final class Bullet
extends ShieldedSprite

A fired bullet.

Author:
mallette
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javoids.BasicSprite
BasicSprite.Collision, BasicSprite.Gravity
 
Field Summary
private static int DEFAULT_SIZE
          The default size for a non-specialized sprite
protected static int MAX_NUMBER
          The maximum number of these sprites allowed in the game (36 directions * 5 shots = 180 bullets)
private static int MAX_SIZE
          The maximum size for a non-specialized sprite
private static int MIN_SIZE
          The minimum size for a non-specialized sprite
private static long serialVersionUID
          This is the version used for serializing/deserializing (storing/retrieving) this object
private  boolean shielded
          is the bullet shielded
private  Item.Type weapon
          the weapon that shot this bullet
 
Fields inherited from class javoids.BasicSprite
size
 
Constructor Summary
Bullet(BasicSprite _parent, Health _health, Move _move, Item _item)
          Constructor
 
Method Summary
 int getDefaultSize()
           
 ImageMap.Name getImageNumber()
           
 int getMaximumSize()
           
 int getMinimumSize()
           
static int getValidSize(int _size)
           
 Item.Type getWeapon()
           
 int modifyDamage(int damage)
          modify the sprite's damage level
 int modifyPoints(int _points)
          modify the sprite's point total
static SpriteVector<Bullet> spawn(BasicSprite parent, int directions, double initialDirection, Health health, Move move, Item item)
          create multiple bullets from a firing wepon
 java.lang.String toString()
          Provide a String representation of this object.
 
Methods inherited from class javoids.ShieldedSprite
accelerate, collide, collisionDetected, draw, getMass, getShield, move, setDirection, setMove, setRotation, setShield, turn
 
Methods inherited from class javoids.Sprite
getAreas, getColors, getMultiplier, getOriginalImage, getShape, setAreas, setColors, setColors, setImage, setShape, setSize
 
Methods inherited from class javoids.BasicSprite
age, collisionDetected, expire, explode, getAgingRate, getAreaChecking, getColor, getDamage, getDeaths, getDirection, getDuration, getGravity, getHealth, getMaxDamage, getMaxDeaths, getMaxDuration, getMaxVelocity, getMove, getPacmanGame, getParent, getPoints, getRelativeVelocity, getRotation, getScreen, getSize, getX, getY, isAlive, isAutomaticMove, isDisplayAreas, isExploded, isGravitySource, isGravityWell, isHoming, isPlayer, isRestorable, kill, modifyDeaths, modifyDuration, setAgingRate, setAreaChecking, setAutomaticMove, setDamage, setDeaths, setDisplayAreas, setDuration, setGravity, setHealth, setHoming, setMaxDamage, setMaxDuration, setMaxLives, setMaxVelocity, setPacmanGame, setParent, setPlayer, setPoints, setScreen, setX, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
This is the version used for serializing/deserializing (storing/retrieving) this object

See Also:
Constant Field Values

MAX_NUMBER

protected static final int MAX_NUMBER
The maximum number of these sprites allowed in the game (36 directions * 5 shots = 180 bullets)

See Also:
Constant Field Values

MAX_SIZE

private static int MAX_SIZE
The maximum size for a non-specialized sprite


MIN_SIZE

private static int MIN_SIZE
The minimum size for a non-specialized sprite


DEFAULT_SIZE

private static int DEFAULT_SIZE
The default size for a non-specialized sprite


shielded

private boolean shielded
is the bullet shielded


weapon

private Item.Type weapon
the weapon that shot this bullet

Constructor Detail

Bullet

public Bullet(BasicSprite _parent,
              Health _health,
              Move _move,
              Item _item)
Constructor

Parameters:
_parent - this sprite's parent sprite
_health - the health information to use
_move - the movement information to use
_item - the type of item this bullet was created from
Method Detail

getDefaultSize

public int getDefaultSize()
Returns:
the default size

getMaximumSize

public int getMaximumSize()
Returns:
the maximum size

getMinimumSize

public int getMinimumSize()
Returns:
the minimum size

getValidSize

public static int getValidSize(int _size)
Parameters:
_size - the size the sprite is desired
Returns:
the passed size, or the minimum, or maximum if it exceed either of those bounds.

getWeapon

public Item.Type getWeapon()
Returns:
the type of item this bullet is

modifyPoints

public int modifyPoints(int _points)
Description copied from class: BasicSprite
modify the sprite's point total

Overrides:
modifyPoints in class BasicSprite
Parameters:
_points - the number of points to add to this sprite's point total
Returns:
the new point total

spawn

public static SpriteVector<Bullet> spawn(BasicSprite parent,
                                         int directions,
                                         double initialDirection,
                                         Health health,
                                         Move move,
                                         Item item)
create multiple bullets from a firing wepon

Parameters:
parent - the parent sprite
directions - the number of directions to shoot in
initialDirection - the initial direction the parent sprite is facing
health - the health infromation
move - the movment information
item - the item that created this(these) sprite(s)
Returns:
a SpriteVector containing all of the fired bullets

getImageNumber

public ImageMap.Name getImageNumber()
Specified by:
getImageNumber in class Sprite
Returns:
the image name for this sprite

modifyDamage

public int modifyDamage(int damage)
Description copied from class: BasicSprite
modify the sprite's damage level

Overrides:
modifyDamage in class BasicSprite
Parameters:
damage - the damage amount of damage this sprite sustained
Returns:
the new damage level

toString

public java.lang.String toString()
Provide a String representation of this object.

Overrides:
toString in class ShieldedSprite
Returns:
String A representation of the object for debugging.