objects
Class Explosion

java.lang.Object
  |
  +--objects.DrawableGameObject
        |
        +--objects.Explosion

public class Explosion
extends DrawableGameObject

This is an explosion object. An explosion has a current and a maximum level. The levels are used to determine the diameter of the drawn object. The level increases to the maximum, then moves down to zero. The server provides the animation by sending new levels at fixed intervals.

If you write a user defined client, you should not try change this object by calling any of it's setter methods, as it will make your view of the game different from all the other players' views.

Also note that for clients, not all getter methods return usable results, as the server doesn't send everything across. The following information is, however, updated and usable for this class:

Author:
Sverre H. Huseby <shh@thathost.com>

Field Summary
 
Fields inherited from class objects.DrawableGameObject
bounds, dir, loc
 
Constructor Summary
Explosion(short id, int x, int y, byte level, byte maxLevel)
          Constructs a new explosion, with the given initial settings.
 
Method Summary
 void draw(java.awt.Graphics g)
          Draws the object in the given graphic context.
 byte getLevel()
          Returns the current level of this explosion.
 byte getMaxLevel()
          Returns the maximum level of this explosion.
 void setLevel(byte level)
          Sets the current level of this explosion.
 void setMaxLevel(byte level)
          Sets the maximum level of this explosion.
 
Methods inherited from class objects.DrawableGameObject
getBounds, getDirection, getDirectionAsShort, getId, getLocation, setDirection, setDirectionFromShort, setId, setLocation, setLocation, updateBounds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Explosion

public Explosion(short id,
                 int x,
                 int y,
                 byte level,
                 byte maxLevel)
Constructs a new explosion, with the given initial settings. Also updates the bounding box of the object.

Parameters:
id - the ID of this object.
x - x-coordinate in the world.
y - y-coordinate.
level - the current level (relative to diameter).
maxLevel - the maximum level.
Method Detail

setLevel

public final void setLevel(byte level)
Sets the current level of this explosion.

Parameters:
level - the level.

getLevel

public final byte getLevel()
Returns the current level of this explosion.

Returns:
the level.

setMaxLevel

public final void setMaxLevel(byte level)
Sets the maximum level of this explosion.

Parameters:
level - the level.

getMaxLevel

public final byte getMaxLevel()
Returns the maximum level of this explosion.

Returns:
the level.

draw

public final void draw(java.awt.Graphics g)
Description copied from class: DrawableGameObject
Draws the object in the given graphic context. The graphic context controls an Image with the size of the entire world, so the drawing routine doesn't need to displace it's coordinates.

Specified by:
draw in class DrawableGameObject
Parameters:
g - the graphic context.
See Also:
DrawableGameObject