|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fi.utu.cs.physics.Body | +--fi.utu.cs.asteroids.Asteroid
An asteroid. The properties of the asteroids are defined by the
parameters asteroidMinimumMass
,
asteroidMaximumMass
, and asteroidsDensity
.
Constructor Summary | |
Asteroid(double m,
Point2 p,
double t)
Creates an asteroid with the mass m at the
position p heading at the direction of the
angle t .
|
Method Summary | |
java.awt.Color |
color()
Returns a Color object that is used for drawing
the outline. |
boolean |
isColliding(Body other)
Returns whether the asteroid collides with the body other .
|
boolean |
isDrawn()
Returns a boolean value indicating whether the outline of the shape is drawn or not. |
boolean |
isFilled()
Returns a boolean value indicating whether the shape is filled or not. |
java.awt.Paint |
paint()
Returns a Paint object that is used for filling
the shape. |
java.awt.Shape |
shape()
Returns a Shape object that defines the appearance
of the object. |
void |
split()
Splits the asteroid. |
java.awt.Stroke |
stroke()
Returns a Stroke object that is used for drawing
the outline. |
java.lang.String |
toString()
Returns a string that contains the values of the attributes. |
Methods inherited from class fi.utu.cs.physics.Body |
advance, elasticCollision, getAcceleration, getMass, getOwner, getPosition, getRadius, getVelocity, isCorporeal, isOverlapping, setAcceleration, setAcceleration, setCorporeal, setEthereal, setMass, setOwner, setPosition, setPosition, setRadius, setVelocity, setVelocity |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Asteroid(double m, Point2 p, double t)
m
at the
position p
heading at the direction of the
angle t
.
The created asteroid uses the initial velocity and acceleration
defined in the parameters asteroidInitialVelocity
and
asteroidInitialAcceleration
. The angle is
in radians.Game
Method Detail |
public boolean isColliding(Body other)
other
.
When an asteroid hits a projectile, the asteroid is split.
The parameter collisionAsteroidAsteroid
defines,
whether the asteroids can collide with each other.isColliding
in class Body
Projectile
,
split()
public void split()
asteroidMinFractionOnSplit
,
asteroidMaxFractionOnSplit
, and
asteroidSumOfFractionsOnSplit
. If the parameter
decorations
is true
, a cloud of debris
is created at the site of the split according to the parameters
debrisOnCloud
and debrisMaxVelocity
.Debris
public java.awt.Shape shape()
Shapable
Shape
object that defines the appearance
of the object.shape
in interface Shapable
fi.utu.cs.appearance.Shapable
Shape
public boolean isDrawn()
Shapable
isDrawn
in interface Shapable
fi.utu.cs.appearance.Shapable
Shapable.stroke()
,
Shapable.color()
public java.awt.Stroke stroke()
Shapable
Stroke
object that is used for drawing
the outline.stroke
in interface Shapable
fi.utu.cs.appearance.Shapable
Shapable.isDrawn()
,
Stroke
public java.awt.Color color()
Shapable
Color
object that is used for drawing
the outline.color
in interface Shapable
fi.utu.cs.appearance.Shapable
Shapable.isDrawn()
,
Color
public boolean isFilled()
Shapable
isFilled
in interface Shapable
fi.utu.cs.appearance.Shapable
Shapable.paint()
public java.awt.Paint paint()
Shapable
Paint
object that is used for filling
the shape.paint
in interface Shapable
fi.utu.cs.appearance.Shapable
Shapable.isFilled()
,
Paint
public java.lang.String toString()
Body
toString
in class Body
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |