|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdata.GameEntity
public abstract class GameEntity
| Field Summary | |
|---|---|
protected double |
dx
The current speed of this entity horizontally (pixels/sec) |
protected double |
dy
The current speed of this entity vertically (pixels/sec) |
protected GameEngine |
ge
GameEngine object is taken to notify GameEngine on specific occurrences |
private java.awt.Rectangle |
other
The rectangle used for other entities during collision resolution |
private java.awt.Rectangle |
own
The rectangle used for this entity during collisions resolution |
protected ScreenManager |
sm
The rectangle used for other entities during collision resolution |
protected Sprite |
sprite
The sprite that represents this entity |
protected double |
x
The current x location of this entity |
protected double |
y
The current y location of this entity |
| Constructor Summary | |
|---|---|
GameEntity(GameEngine ge,
java.lang.String file,
int x,
int y,
ScreenManager sm)
This is the constructor of our abstract class GameEntity. |
|
| Method Summary | |
|---|---|
abstract void |
collidedWith(GameEntity entity)
Collision responses will take within Game Entities. |
boolean |
collidesWith(GameEntity entity)
This method check the collision between itself and another entity. |
void |
draw(java.awt.Graphics2D g)
This method draws the visual of the entity to the screen. |
int |
getX()
|
int |
getY()
|
void |
move(long delta)
Moves the entity. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected double x
protected double y
protected Sprite sprite
protected double dx
protected double dy
private java.awt.Rectangle own
private java.awt.Rectangle other
protected ScreenManager sm
protected GameEngine ge
| Constructor Detail |
|---|
public GameEntity(GameEngine ge,
java.lang.String file,
int x,
int y,
ScreenManager sm)
ge - GameEngine object to send specific messages on specific occurrences.file - Path to the image.x - X position of the object.y - Y position of the object.sm - ScreenManager object to determine the boundaries of the screen.| Method Detail |
|---|
public int getX()
public int getY()
public void move(long delta)
delta - is the amount of time that entity will move.public void draw(java.awt.Graphics2D g)
g - A Graphics2D object coming from GameEnginepublic boolean collidesWith(GameEntity entity)
GameEngine calls this method for each entity and they return a
boolean value if collision occurs.
entity - Entity to be collided.
public abstract void collidedWith(GameEntity entity)
entity -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||