|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.petterroea.starterkit.Entity
public class Entity
A standard entity for use in a game
| Field Summary | |
|---|---|
java.awt.Rectangle |
collisionbox
The collisionbox of the entity |
Sprite |
entitysprite
The sprite used by the entity |
int |
height
Height of the entity |
boolean |
removeMe
True if the entity is dead and should be removed |
int |
width
Width of the entity |
double |
x
X position with decimals, for greater accuracy |
double |
xspeed
X axis speed in decimals, for greater accuracy |
double |
y
Y position with decimals, for greater accuracy |
double |
yspeed
Y axis speed in decimals, for greater accuracy |
| Constructor Summary | |
|---|---|
Entity(int x,
int y)
Constructor for a entity |
|
| Method Summary | |
|---|---|
private boolean |
canCollideWith(Entity entity)
Checks if an entity can collide with another entity |
void |
draw(java.awt.Graphics g,
int xoff,
int yoff)
Draws the entity |
boolean |
isVisible(int xoff,
int yoff)
Checks if this is drawable in the window(In viewing range) |
void |
update(int delta)
Updates the entity's x and y postition based on x and y speed |
void |
update(int delta,
java.util.LinkedList<Entity> map,
int pos)
Updates the entity's position, while paying attention to other entities |
void |
update(int delta,
Map map,
int pos)
Updates the entity's position, while paying attention to Both tiles and entities in a map. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public double x
public double y
public double xspeed
public double yspeed
public int width
public int height
public java.awt.Rectangle collisionbox
public Sprite entitysprite
public boolean removeMe
| Constructor Detail |
|---|
public Entity(int x,
int y)
x - The x axis position of the entityy - The y axis position of the entity| Method Detail |
|---|
public void update(int delta)
delta - Milliseconds since last update
public void update(int delta,
java.util.LinkedList<Entity> map,
int pos)
delta - Time since last updatemap - The list of entitiespos - This enties position in the list
public void update(int delta,
Map map,
int pos)
delta - Time since last update in msmap - The map this is usingpos - This enties position in the listprivate boolean canCollideWith(Entity entity)
entity - The entity to check against
public void draw(java.awt.Graphics g,
int xoff,
int yoff)
g - The graphics objectxoff - x offset in pixelsyoff - y offset in pixels
public boolean isVisible(int xoff,
int yoff)
xoff - X axis offsetyoff - Y axis offset
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||