|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgame_LT2.ProjectileSprite
public class ProjectileSprite
This class encapsulates an on-screen sprite that represents a projectile in our game. A projectile is either live or dead. Only live projectiles are shown on-screen. It has a linear trajectory that is represented by an x and y displacement per frame.
Constructor Summary | |
---|---|
ProjectileSprite(java.awt.Dimension dimensionOfDrawingRegion,
java.awt.Point initialPosition,
int xDisplacement,
int yDisplacement)
Constructs a sprite located at the 0,0 position |
Method Summary | |
---|---|
int |
getCurrentX()
Accessor for this sprite's current x position |
int |
getCurrentY()
Accessor for this sprite's current y position |
void |
move()
Mutate the position of this projectile. |
void |
setAnchor(int x,
int y)
Mutates this sprite's anchor position |
void |
specifyDrawing(java.awt.Graphics2D g)
This method takes the passed Graphics2D object and specifies how this sprite should be drawn on it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProjectileSprite(java.awt.Dimension dimensionOfDrawingRegion, java.awt.Point initialPosition, int xDisplacement, int yDisplacement)
dimensionOfDrawingRegion
- Method Detail |
---|
public void setAnchor(int x, int y)
x
- y
- public int getCurrentX()
public int getCurrentY()
public void move()
public void specifyDrawing(java.awt.Graphics2D g)
specifyDrawing
in interface Sprite
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |