|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsprite.Sprite
sprite.sprite2d.Sprite2D
public abstract class Sprite2D
Last updated September 23, 2006.
Extends Sprite. This is the base 2d bean class to be used for all 2d sprites.
Added startX and startY to store the starting x and y positions. These can be used for a reference distance moved.
Added check collision, checks to see if the given point falls within range of the sprite.
| Field Summary | |
|---|---|
protected boolean |
fill
The fill state of the sprite. |
protected java.awt.Color |
spriteColor
The color of the sprite. |
| Fields inherited from class sprite.Sprite |
|---|
active, visible |
| Constructor Summary | |
|---|---|
Sprite2D()
Creates a new Sprite2D(). |
|
| Method Summary | |
|---|---|
boolean |
checkCollision(int xp,
int yp)
Checks for a collision. |
int |
getHeight()
Gets the height of the sprite. |
java.awt.Color |
getSpriteColor()
Gets the color of the sprite. |
double |
getStartX()
Gets the starting x position. |
double |
getStartY()
Gets the starting y position. |
int |
getWidth()
Gets the width of the sprite. |
double |
getXPosition()
Gets the x position. |
double |
getYPosition()
Gets the y position. |
boolean |
isFill()
The fill state of the sprite. |
void |
setFill(boolean fill)
Sets the fill state of the sprite. |
void |
setHeight(int height)
Sets the height of the sprite. |
void |
setSpriteColor(java.awt.Color spriteColor)
Sets the sprite's color. |
void |
setStartX(double startX)
Sets the starting x position. |
void |
setStartY(double startY)
Sets that starting y position. |
void |
setWidth(int width)
Sets the width of the sprite. |
void |
setXPosition(double xPosition)
Sets the x position. |
void |
setYPosition(double yPosition)
Sets the y position. |
| Methods inherited from class sprite.Sprite |
|---|
addPropertyChangeListener, getPropertySupport, isActive, isVisible, paintSprite, removePropertyChangeListener, restore, setActive, setVisible, suspend, updateSprite |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.awt.Color spriteColor
protected boolean fill
| Constructor Detail |
|---|
public Sprite2D()
| Method Detail |
|---|
public double getXPosition()
public void setXPosition(double xPosition)
xPosition - The new xPosition.public double getYPosition()
public void setYPosition(double yPosition)
yPosition - The new y position.public int getWidth()
public void setWidth(int width)
width - The new width.public int getHeight()
public void setHeight(int height)
height - The new height.public java.awt.Color getSpriteColor()
public void setSpriteColor(java.awt.Color spriteColor)
spriteColor - The new color.public boolean isFill()
public void setFill(boolean fill)
fill - The new fill state.public double getStartX()
public void setStartX(double startX)
startX - The new starting x position.public double getStartY()
public void setStartY(double startY)
startY - The new starting y position.
public boolean checkCollision(int xp,
int yp)
xp - The x position of a possible collision.yp - The y position of a possible collision.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||