location
Class LocationExit

java.lang.Object
  extended by location.Hotspot
      extended by location.LocationExit
All Implemented Interfaces:
java.io.Serializable

public class LocationExit
extends Hotspot

This class represents an exit from a game location

Author:
Frank Bruns
See Also:
Serialized Form

Constructor Summary
LocationExit(java.lang.String name, java.lang.String bshName, double x, double y, int width, int height, double newX, double newY, boolean usable, GameLocation start, GameLocation dest, com.golden.gamedev.engine.BaseInput bsInput)
           
 
Method Summary
 java.lang.String getBshName()
          Return the beanshell name of this location exit
 GameLocation getDestinationLocation()
          Returns the location to which the location exit leads to.
 GameLocation getStartLocation()
          Returns the location from which the exit leads to new location.
 boolean isInRange(AbstractCharacterSprite character)
          Determines whether the exit is in range for a character
 boolean isNotedForUse()
          Returns whether the exit is noted for use
 boolean isUsable()
          Determines whether the exit can be used
 void setNotedForUse(boolean use)
          Sets whether the exit was noted for use by the player
 void setUsable(boolean usable)
          Sets if the exit can be used
 void use(AbstractCharacterSprite character)
          Call this method to signal that the character wants to make a transition from this exit's start location to its destination location.
 
Methods inherited from class location.Hotspot
getHeight, getName, getWidth, getX, getY, isMouseOverHotspot, isMouseOverInventHotspot, isPointInHotspot, isPointInInventHotspot, render, setHeight, setName, setWidth, setX, setY, showName, update
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocationExit

public LocationExit(java.lang.String name,
                    java.lang.String bshName,
                    double x,
                    double y,
                    int width,
                    int height,
                    double newX,
                    double newY,
                    boolean usable,
                    GameLocation start,
                    GameLocation dest,
                    com.golden.gamedev.engine.BaseInput bsInput)
Parameters:
name - name of the location exit
bshName - beanshell name for the location exit
x - x-coordinate
y - y-coordinate
width - width of the location exit
height - height of the location exit
newX - new x-coordinate for the player
newY - new y-coordinate for the player
usable - determines if the exit can be initially used
start - game location the player can leave with the exit (start location)
dest - game location to which the exit leads to (destination)
bsInput -
Method Detail

getBshName

public java.lang.String getBshName()
Return the beanshell name of this location exit

Returns:
beanshell name of this location exit

getStartLocation

public GameLocation getStartLocation()
Returns the location from which the exit leads to new location. That is the start location of the exit.

Returns:
start game location

getDestinationLocation

public GameLocation getDestinationLocation()
Returns the location to which the location exit leads to. This will be the next location to visit, if the exit is used

Returns:
destination game location

isUsable

public boolean isUsable()
Determines whether the exit can be used

Returns:
can the exit be used? --> true=yes, false=no

setUsable

public void setUsable(boolean usable)
Sets if the exit can be used

Parameters:
usable - is exit usable? true=yes, false=no

setNotedForUse

public void setNotedForUse(boolean use)
Sets whether the exit was noted for use by the player

Parameters:
use - use the exit? true=yes, false=no

isNotedForUse

public boolean isNotedForUse()
Returns whether the exit is noted for use

Returns:
is exit noted for use? true=yes, false=no

isInRange

public boolean isInRange(AbstractCharacterSprite character)
Determines whether the exit is in range for a character

Parameters:
character - character that is checked for the range to the exit
Returns:
is exit in range for the player? true=yes, false=no

use

public void use(AbstractCharacterSprite character)
Call this method to signal that the character wants to make a transition from this exit's start location to its destination location. Basically everything this method does is to set the start location to "not active" and the destination location to "active" by calling the locations' setActive() methods. Furthermore the player gets removed from the start location and get added to the destination location

Parameters:
character - character that uses the exit