edu.trinity.cs.gamecore
Class EditorPlayer

java.lang.Object
  extended by edu.trinity.cs.gamecore.EditorPlayer
All Implemented Interfaces:
GameEntity, Player, java.io.Serializable

public class EditorPlayer
extends java.lang.Object
implements Player

This class is just used by the editor to help it interact with the MainDisplay class.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.trinity.cs.gamecore.Player
Player.GameStatus, Player.PanelLoc
 
Constructor Summary
EditorPlayer()
           
 
Method Summary
 boolean followLinks()
          Tells if this entity should follow links from one screen to another.
 Player.GameStatus gameStatus()
          Returns one of the three constants above telling what the status of the game is.
 java.awt.Container getEditPropertiesPanel()
          This method should return a java.awt.Container with GUI components set up in it to edit the properties of this entity.
 java.awt.Container getGameStatusPanel(Player.PanelLoc loc)
          This method returns a GUI container that shows extra information in your game.
 java.awt.Image getImage()
          This returns the image that should be drawn for this entity.
 Location getLocation()
          This returns the location of this entity.
 int getUpdateTime()
          This method returns the next time at which the entity should have its update method called.
 int partialSizeX()
          This method returns how many partials across the entity should be.
 int partialSizeY()
          This method returns how many partials up and down the entity should be.
 void setLocation(Location location)
          This sets the location of this entity.
 void update(int time)
          The update method is where any changes to the entity are made.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EditorPlayer

public EditorPlayer()
Method Detail

gameStatus

public Player.GameStatus gameStatus()
Description copied from interface: Player
Returns one of the three constants above telling what the status of the game is.

Specified by:
gameStatus in interface Player

getGameStatusPanel

public java.awt.Container getGameStatusPanel(Player.PanelLoc loc)
Description copied from interface: Player
This method returns a GUI container that shows extra information in your game. For example, this might be where you display the score to the user. I recommend that you use a JPanel here, but it should work with any form of java.awt.Container. This region can be interactive as well if it has elements in it that handle events. In some games this might be where you can select options of things like that. It should return null if nothing is to be displayed. The argument says which area this panel is for. It should be one of the PanelLoc constants such as NORTH;

Specified by:
getGameStatusPanel in interface Player
Parameters:
loc - This integer specifies which side of the display the panel is being requested for.
Returns:
The panel that should go at that location or null if none.

update

public void update(int time)
Description copied from interface: GameEntity
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.

Specified by:
update in interface GameEntity
Parameters:
time - This is the current time in the game.

followLinks

public boolean followLinks()
Description copied from interface: GameEntity
Tells if this entity should follow links from one screen to another.

Specified by:
followLinks in interface GameEntity
Returns:
A boolean value telling if it follows links or not.

getUpdateTime

public int getUpdateTime()
Description copied from interface: GameEntity
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.

Specified by:
getUpdateTime in interface GameEntity
Returns:
The next time that this entity should be updated or -1 if it shouldn't be.

getLocation

public Location getLocation()
Description copied from interface: GameEntity
This returns the location of this entity.

Specified by:
getLocation in interface GameEntity
Returns:
The current location of this entity.

setLocation

public void setLocation(Location location)
Description copied from interface: GameEntity
This sets the location of this entity.

Specified by:
setLocation in interface GameEntity

getImage

public java.awt.Image getImage()
Description copied from interface: GameEntity
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.

Specified by:
getImage in interface GameEntity
Returns:
The image that is to be drawn for this entity.

partialSizeX

public int partialSizeX()
Description copied from interface: GameEntity
This method returns how many partials across the entity should be. For a "standard" entity that take up a whole block, this should return Location.getPartialsInWhole();

Specified by:
partialSizeX in interface GameEntity
Returns:
How many partials across the entity should take up when drawn.

partialSizeY

public int partialSizeY()
Description copied from interface: GameEntity
This method returns how many partials up and down the entity should be. For a "standard" entity that take up a whole block, this should return Location.getPartialsInWhole();

Specified by:
partialSizeY in interface GameEntity
Returns:
How many partials vertically the entity should take up when drawn.

getEditPropertiesPanel

public java.awt.Container getEditPropertiesPanel()
Description copied from interface: GameEntity
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.

Specified by:
getEditPropertiesPanel in interface GameEntity
Returns:
A GUI entity used in the editor to change entity properties.