|
||||||||
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.physics.MomentaryBody | +--fi.utu.cs.asteroids.Projectile
A projectile. The lifetime of the projectiles is defined by the
parameter projectileLifetime
.
Constructor Summary | |
Projectile(Point2 p,
double t,
Ship s)
Creates a projectile at the position p heading at
the direction of the angle t and launched by the ship
s . |
Method Summary | |
java.awt.Color |
color()
Returns a Color object that is used for drawing
the outline. |
void |
die()
Removes this projectile from the universe. |
Ship |
getLauncher()
Returns the ship that launched this projectile. |
boolean |
isColliding(Body other)
Returns whether the projectile 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. |
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.MomentaryBody |
advance, getLifetime, setLifetime |
Methods inherited from class fi.utu.cs.physics.Body |
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 Projectile(Point2 p, double t, Ship s)
p
heading at
the direction of the angle t
and launched by the ship
s
. The mass of the projectile is defined by
the parameter projectileMass
and the size by the
parameter projectileRadius
. The created projectile
uses the initial velocity and acceleration defined in the parameters
projectileInitialVelocity
and
projectileInitialAcceleration
.
The angle is in radians.Game
Method Detail |
public Ship getLauncher()
public void die()
die
in class MomentaryBody
public boolean isColliding(Body other)
other
. When a projectile hits an asteroid,
the projectile is removed.
The parameter collisionProjectileShip
defines,
whether the ships can collide with the projectiles.
The parameter collisionProjectileProjectile
defines,
whether the projectiles can collide with each other.isColliding
in class Body
Asteroid
,
Ship
,
die()
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 |