edu.trinity.cs.gamecore.madison
Class MadisonPlayer

java.lang.Object
  extended by edu.trinity.cs.gamecore.madison.MadisonPlayer
All Implemented Interfaces:
GameEntity<MadisonBlock,MadisonEntity>, MadisonEntity, Player<MadisonBlock,MadisonEntity>, java.awt.event.MouseMotionListener, java.io.Serializable, java.util.EventListener

public class MadisonPlayer
extends java.lang.Object
implements MadisonEntity, java.awt.event.MouseMotionListener, Player<MadisonBlock,MadisonEntity>

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.trinity.cs.gamecore.Player
Player.GameStatus, Player.PanelLoc
 
Constructor Summary
MadisonPlayer(Location<MadisonBlock,MadisonEntity> l)
           
 
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<MadisonBlock,MadisonEntity> 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.
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 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<MadisonBlock,MadisonEntity> l)
          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

MadisonPlayer

public MadisonPlayer(Location<MadisonBlock,MadisonEntity> l)
Method Detail

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<MadisonBlock,MadisonEntity>
Returns:
The next time that this entity should be updated or -1 if it shouldn't be.

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<MadisonBlock,MadisonEntity>
Parameters:
time - This is the current time in the game.

getLocation

public Location<MadisonBlock,MadisonEntity> getLocation()
Description copied from interface: GameEntity
This returns the location of this entity.

Specified by:
getLocation in interface GameEntity<MadisonBlock,MadisonEntity>
Returns:
The current location of this entity.

setLocation

public void setLocation(Location<MadisonBlock,MadisonEntity> l)
Description copied from interface: GameEntity
This sets the location of this entity.

Specified by:
setLocation in interface GameEntity<MadisonBlock,MadisonEntity>

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<MadisonBlock,MadisonEntity>
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<MadisonBlock,MadisonEntity>
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<MadisonBlock,MadisonEntity>
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<MadisonBlock,MadisonEntity>
Returns:
A GUI entity used in the editor to change entity properties.

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<MadisonBlock,MadisonEntity>
Returns:
A boolean value telling if it follows links or not.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

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<MadisonBlock,MadisonEntity>

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<MadisonBlock,MadisonEntity>
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.