|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavoids.BasicSprite
javoids.Sprite
javoids.GravityPoint
javoids.Singularity
public final class Singularity
A singularity (not quite, but close enough). This is used for white and black holes. White holes repel and sometimes create Javoids. Black holes attract and destroy anything that enters them.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javoids.BasicSprite |
---|
BasicSprite.Collision, BasicSprite.Gravity |
Field Summary | |
---|---|
private static double |
DEFAULT_MOVING_CHANCE
the default chance that a singularity will move |
protected static int |
DEFAULT_SIZE
the sprite's default size |
private int |
initialSize
the initial size of the singularity |
static int |
MAX_NUMBER
The maximum number of these sprites allowed in the game |
protected static int |
MAX_SIZE
the sprite's maximum size |
protected static int |
MIN_SIZE
the sprite's minimum size |
private static long |
serialVersionUID
This is the version used for serializing/deserializing (storing/retrieving) this object |
Fields inherited from class javoids.GravityPoint |
---|
DEFAULT_AGING_RATE, DEFAULT_DURATION, MAX_DEATHS, MAX_DURATION, MAXIMUM_DAMAGE_CAPACITY |
Fields inherited from class javoids.BasicSprite |
---|
size |
Constructor Summary | |
---|---|
Singularity(BasicSprite parent,
Health health,
Move move,
int _size)
Constructor |
Method Summary | |
---|---|
int |
collide(BasicSprite sprite,
BasicSprite.Collision collisionType)
|
int |
collide(Explosion sprite,
BasicSprite.Collision collisionType)
|
int |
collide(Shield sprite,
BasicSprite.Collision collisionType)
|
int |
collide(ShieldedSprite sprite,
BasicSprite.Collision collisionType)
|
int |
collide(Singularity sprite,
BasicSprite.Collision collisionType)
|
int |
getDefaultSize()
|
double |
getMass()
|
int |
getMaximumSize()
|
int |
getMinimumSize()
|
void |
grow(int amount)
Cause a singularity to change its size. |
void |
move()
Move the singularity if it moves at all. |
void |
setGravity(BasicSprite.Gravity gravity)
set the sprite's gravity |
private void |
setShape()
Set the shape and colors of the singularity (based on the gravity type). |
void |
setSize(int _size)
set the sprite's size |
java.lang.String |
toString()
Provide a String representation of this object. |
Methods inherited from class javoids.GravityPoint |
---|
getImageNumber |
Methods inherited from class javoids.Sprite |
---|
draw, getAreas, getColors, getMultiplier, getOriginalImage, getShape, setAreas, setColors, setColors, setImage, setShape |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
public static final int MAX_NUMBER
private static final double DEFAULT_MOVING_CHANCE
protected static final int MAX_SIZE
protected static final int MIN_SIZE
protected static final int DEFAULT_SIZE
private int initialSize
Constructor Detail |
---|
public Singularity(BasicSprite parent, Health health, Move move, int _size)
parent
- the parent of this spritehealth
- the health informationmove
- the movment information_size
- the size this should beMethod Detail |
---|
public int getDefaultSize()
getDefaultSize
in interface Sizes
getDefaultSize
in class GravityPoint
public int getMaximumSize()
getMaximumSize
in interface Sizes
getMaximumSize
in class GravityPoint
public int getMinimumSize()
getMinimumSize
in interface Sizes
getMinimumSize
in class GravityPoint
public void setSize(int _size)
BasicSprite
setSize
in class GravityPoint
_size
- the size to set for this spritepublic double getMass()
getMass
in class GravityPoint
public void setGravity(BasicSprite.Gravity gravity)
BasicSprite
setGravity
in class BasicSprite
gravity
- the gravity type to use for the singularityprivate void setShape()
public void grow(int amount)
amount
- the amount to make the singularity grow.public void move()
move
in class BasicSprite
public int collide(Singularity sprite, BasicSprite.Collision collisionType)
sprite
- The sprite that is colliding into this sprite.collisionType
- The type of interaction required for this collision (shield on shield etc).
public int collide(BasicSprite sprite, BasicSprite.Collision collisionType)
collide
in class BasicSprite
sprite
- The sprite that is colliding into this sprite.collisionType
- The type of interaction required for this collision (shield on shield etc).
public int collide(Explosion sprite, BasicSprite.Collision collisionType)
sprite
- The sprite that is colliding into this sprite.collisionType
- The type of interaction required for this collision (shield on shield etc).
public int collide(Shield sprite, BasicSprite.Collision collisionType)
sprite
- The sprite that is colliding into this sprite.collisionType
- The type of interaction required for this collision (shield on shield etc).
public int collide(ShieldedSprite sprite, BasicSprite.Collision collisionType)
sprite
- The sprite that is colliding into this sprite.collisionType
- The type of interaction required for this collision (shield on shield etc).
public java.lang.String toString()
toString
in class GravityPoint
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |