| Modifier and Type | Field and Description |
|---|---|
| protected float | dx
The current speed of this entity horizontally (pixels/sec) |
| protected float | dy
The current speed of this entity vertically (pixels/sec) |
| private Rectangle | him
The rectangle used for other entities during collision resolution |
| private Rectangle | me
The rectangle used for this entity during collisions resolution |
| protected Sprite | sprite
The sprite that represents this entity |
| protected float | x
The current x location of this entity |
| protected float | y
The current y location of this entity |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public abstract void | collidedWith(Entity
The entity with which this entity collided. other)Notification that this entity collided with another. |
| public boolean | Returns: True if the entities collide with each otherThe other entity to check collision against other)Check if this entity collised with another. |
| public void | |
| public void | |
| public float | Returns: The horizontal speed of this entity (pixels/sec)Get the horizontal speed of this entity |
| public float | Returns: The vertical speed of this entity (pixels/sec)Get the vertical speed of this entity |
| public int | |
| public int | |
| public void | move(long
The ammount of time that has passed in milliseconds delta)Request that this entity move itself based on a certain ammount of time passing. |
| public void | setHorizontalMovement(float
The horizontal speed of this entity (pixels/sec) dx)Set the horizontal speed of this entity |
| public void | setVerticalMovement(float
The vertical speed of this entity (pixels/sec) dy)Set the vertical speed of this entity |
| dx | back to summary |
|---|---|
| protected float dx The current speed of this entity horizontally (pixels/sec) | |
| dy | back to summary |
|---|---|
| protected float dy The current speed of this entity vertically (pixels/sec) | |
| him | back to summary |
|---|---|
| private Rectangle him The rectangle used for other entities during collision resolution | |
| me | back to summary |
|---|---|
| private Rectangle me The rectangle used for this entity during collisions resolution | |
| sprite | back to summary |
|---|---|
| protected Sprite sprite The sprite that represents this entity | |
| x | back to summary |
|---|---|
| protected float x The current x location of this entity | |
| y | back to summary |
|---|---|
| protected float y The current y location of this entity | |
| Entity | back to summary |
|---|---|
| protected Entity(Sprite sprite, int x, int y) Construct a entity based on a sprite image and a location.
| |
| collidedWith | back to summary |
|---|---|
| public abstract void collidedWith(Entity other) Notification that this entity collided with another.
| |
| collidesWith | back to summary |
|---|---|
| public boolean collidesWith(Entity other) Check if this entity collised with another.
| |
| doLogic | back to summary |
|---|---|
| public void doLogic() Do the logic associated with this entity. This method will be called periodically based on game events | |
| draw | back to summary |
|---|---|
| public void draw() Draw this entity to the graphics context provided | |
| getHorizontalMovement | back to summary |
|---|---|
| public float getHorizontalMovement() Get the horizontal speed of this entity
| |
| getVerticalMovement | back to summary |
|---|---|
| public float getVerticalMovement() Get the vertical speed of this entity
| |
| getX | back to summary |
|---|---|
| public int getX() Get the x location of this entity
| |
| getY | back to summary |
|---|---|
| public int getY() Get the y location of this entity
| |
| move | back to summary |
|---|---|
| public void move(long delta) Request that this entity move itself based on a certain ammount of time passing.
| |
| setHorizontalMovement | back to summary |
|---|---|
| public void setHorizontalMovement(float dx) Set the horizontal speed of this entity
| |
| setVerticalMovement | back to summary |
|---|---|
| public void setVerticalMovement(float dy) Set the vertical speed of this entity
| |