edu.trinity.cs.gamecore
Interface Block<B extends Block<B,E>,E extends GameEntity<B,E>>

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
BasicBlock, BasicBlock1

public interface Block<B extends Block<B,E>,E extends GameEntity<B,E>>
extends java.io.Serializable

This interface will be implemented for any class that should represent a block on a screen in the game. They basically provide a background upon which the player interacts with things.

This class is a generic that takes the general block type and the general entity type for each game.


Method Summary
 java.awt.Container getEditPropertiesPanel()
          This method returns a panel that should be set up so that users can edit the properties of this block.
 java.awt.Image getImage()
          This returns the image that should be drawn for this block.
 Location<B,E> getLinkLocation()
          Returns the location that this block links to.
 void setLinkLocation(Location<B,E> location)
          Sets the location that this block links to.
 

Method Detail

getImage

java.awt.Image getImage()
This returns the image that should be drawn for this block. What is returned will be scaled to the size of one block for drawing. Note that blocks will not properly display animations.

Returns:
The image that is to be drawn for this block.

getEditPropertiesPanel

java.awt.Container getEditPropertiesPanel()
This method returns a panel that should be set up so that users can edit the properties of this block. Block properties can be used to reduce the number of block types that you create if you have many blocks in your game that server very similar functions. The returned value can be any java.awt.Container though I recommend that you use javax.swing.JPanel. The properties for blocks don't have to include link locations because the screen editor handles those in another way.

Returns:
A Container with a GUI set up for editing properties. If there are no editable properties it should return null.

getLinkLocation

Location<B,E> getLinkLocation()
Returns the location that this block links to. When an entity that follows links moves onto a block with a link it will be "transported" to that location. If a given type of block should never have a link from it, this can simply return null.

Returns:
The location this block links to or null if no link.

setLinkLocation

void setLinkLocation(Location<B,E> location)
Sets the location that this block links to. Some blocks can ignore this if they don't support linking.

Parameters:
location - The location the block should link to.