Interface GameEntity

All Known Subinterfaces:
Player
All Known Implementing Classes:
BasicEntity

public interface GameEntity
extends Serializable

This interface will be implemented for any class that should represent an
entity in the game. Player is a subclass of this. The entities are all objects
that move or have animations in the game.


Method Summary
 booleanfollowLinks()
          Tells if this entity should follow links from one screen to another.
 ContainergetEditPropertiesPanel()
          This method should return a java.awt.Container with GUI components set
up in it to edit the properties of this entity.
 ImagegetImage()
          This returns the image that should be drawn for this entity.
 LocationgetLocation()
          This returns the location of this entity.
 intgetUpdateTime()
          This method returns the next time at which the entity should have its
update method called.
 voidsetLocation(Location loc)
          This sets the location of this entity.
 voidupdate(int time)
          The update method is where any changes to the entity are made.

Method Detail

followLinks

public boolean followLinks()
Tells if this entity should follow links from one screen to another.
Returns: A boolean value telling if it follows links or not.

getEditPropertiesPanel

public Container getEditPropertiesPanel()
This method should return a java.awt.Container with GUI components set
up in it to edit the properties of this entity. The entity should not
have a reference to the Container because that could interfer with
saving to disk. I recommend using a javax.swing.JPanel as your Container,
but any Container should work. This method is only called in the
screen editor, not during the game. If your entity doesn't have any
properties that should be changable in the editor this should return null.
Returns: A GUI entity used in the editor to change entity properties.

getImage

public Image getImage()
This returns the image that should be drawn for this entity. What is
returned will be scaled to the size of one block for drawing.
Returns: The image that is to be drawn for this entity.

getLocation

public Location getLocation()
This returns the location of this entity.
Returns: The current location of this entity.

getUpdateTime

public int getUpdateTime()
This method returns the next time at which the entity should have its
update method called. A negative value prevents it from being put on
the event queue.
Returns: The next time that this entity should be updated or -1 if it shouldn't be.

setLocation

public void setLocation(Location loc)
This sets the location of this entity.

update

public void update(int time)
The update method is where any changes to the entity are made. This
will mainly be moving the object, but can also include collision
detection and handling with other things in the game and updating
animations.
Parameters:
time This is the current time in the game.