|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavoids.BasicSprite
javoids.Sprite
javoids.ShieldedSprite
public abstract class ShieldedSprite
A sprite with a shield (also a sprite).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javoids.BasicSprite |
---|
BasicSprite.Collision, BasicSprite.Gravity |
Field Summary | |
---|---|
private static long |
serialVersionUID
This is the version used for serializing/deserializing (storing/retrieving) this object |
private Shield |
shield
the ship's sheild |
Fields inherited from class javoids.BasicSprite |
---|
size |
Constructor Summary | |
---|---|
protected |
ShieldedSprite(BasicSprite parent,
Health health,
Move move,
Shield _shield,
int _size,
ImageMap.Name image,
java.util.Vector<java.awt.geom.Area> areas,
java.util.Vector<java.awt.Color> colors)
Constructor |
Method Summary | |
---|---|
void |
accelerate(double acceleration)
|
int |
collide(BasicSprite sprite,
BasicSprite.Collision collisionType)
|
BasicSprite.Collision |
collisionDetected(ShieldedSprite shieldedSprite)
Detect for collisions between two sprites. |
void |
draw(java.awt.Graphics2D g2d,
java.awt.Graphics2D foregroundImage)
Draw the shield and sprite image. |
double |
getMass()
|
Shield |
getShield()
|
void |
move()
Move the sprite according to its velocity. |
void |
setDirection(double direction)
set the sprite's direction |
void |
setMove(Move move)
set the sprite's movement information |
void |
setRotation(double amount)
set the sprite's rotation amount |
void |
setShield(Shield _shield)
|
java.lang.String |
toString()
Provide a String representation of this object. |
void |
turn(double turn_direction,
double amount)
turn the sprite to a new direction |
Methods inherited from class javoids.Sprite |
---|
getAreas, getColors, getImageNumber, getMultiplier, getOriginalImage, getShape, setAreas, setColors, setColors, setImage, setShape, setSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javoids.Sizes |
---|
getDefaultSize, getMaximumSize, getMinimumSize |
Field Detail |
---|
private static final long serialVersionUID
private Shield shield
Constructor Detail |
---|
protected ShieldedSprite(BasicSprite parent, Health health, Move move, Shield _shield, int _size, ImageMap.Name image, java.util.Vector<java.awt.geom.Area> areas, java.util.Vector<java.awt.Color> colors)
parent
- the parent spritehealth
- the health informationmove
- the movement information_shield
- the shield information_size
- the size of the spriteimage
- the sprite's original imageareas
- the areas that represent the spritecolors
- the colors that match the areas of the spriteMethod Detail |
---|
public Shield getShield()
public void setShield(Shield _shield)
_shield
- the shield to give this spritepublic void setMove(Move move)
BasicSprite
setMove
in class BasicSprite
move
- the movement information to setpublic void setDirection(double direction)
BasicSprite
setDirection
in class BasicSprite
direction
- the direction to setpublic void setRotation(double amount)
BasicSprite
setRotation
in class BasicSprite
amount
- the amount to rotate every time the direction is changedpublic BasicSprite.Collision collisionDetected(ShieldedSprite shieldedSprite)
shieldedSprite
- the other sprite
public int collide(BasicSprite sprite, BasicSprite.Collision collisionType)
collide
in class BasicSprite
sprite
- check for a collision with this spritecollisionType
- the collision type
public void draw(java.awt.Graphics2D g2d, java.awt.Graphics2D foregroundImage)
draw
in class Sprite
g2d
- the graphics context to use for drawing.foregroundImage
- the image to draw on for double bufferingpublic double getMass()
getMass
in class BasicSprite
public void accelerate(double acceleration)
accelerate
in class BasicSprite
acceleration
- the amount to accelerate by at one timepublic void turn(double turn_direction, double amount)
BasicSprite
turn
in class BasicSprite
turn_direction
- the direction to turnamount
- the amount to turn bypublic void move()
move
in class BasicSprite
public java.lang.String toString()
toString
in class Sprite
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |