public class Zone extends java.lang.Object implements Drawable, java.io.Serializable
Constructor and Description |
---|
Zone(int x,
int y,
Shape shape)
Constructs a zone.
|
Modifier and Type | Method and Description |
---|---|
void |
addEntity(Entity e)
Adds an entity to the zone.
|
void |
clear()
Removes all entities from the zone.
|
boolean |
contains(int x,
int y)
Tests if a click is in the zone.
|
void |
draw(java.awt.Graphics g)
Draw the object on screen.
|
Entity |
getEntity(int i) |
int |
getNbEntities() |
Shape |
getShape() |
int |
getX() |
int |
getY() |
boolean |
isEmpty() |
void |
removeEntity(Entity e)
Removes an entity from the zone.
|
public Zone(int x, int y, Shape shape)
x
- x-coordinate of the zone.y
- y-coordinate of the zone.shape
- Shape of the zone.public void addEntity(Entity e)
e
- Entity to be added.public void removeEntity(Entity e)
e
- Entity to be removed.public void clear()
public boolean isEmpty()
public void draw(java.awt.Graphics g)
Drawable
public boolean contains(int x, int y)
x
- x-coordinate of the click.y
- y-coordinate of the click.public Shape getShape()
public Entity getEntity(int i)
i
- Index of the entity to return.public int getX()
public int getY()
public int getNbEntities()