location
Class Hotspot

java.lang.Object
  extended by location.Hotspot
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
InteractiveHotspot, LocationExit

public class Hotspot
extends java.lang.Object
implements java.io.Serializable

This class represents a hotspot in the game. Hotspots are areas of special interest on the screen. This could be items, characters or just an interesting place. Hotspots are represented by an invisible rectangle defining the area of the hotspot

Author:
Frank Bruns
See Also:
Serialized Form

Constructor Summary
Hotspot(java.lang.String name, double x, double y, int width, int height, com.golden.gamedev.engine.BaseInput bsInput)
          Creates a new hotspot with the specified parameters
 
Method Summary
 int getHeight()
          Returns the height of the hotspot area
 java.lang.String getName()
          Returns the name of the hotspot area
 int getWidth()
          Returns the width of the hotspot area
 double getX()
          Returns the x-coordinate of the hotspot area
 double getY()
          Returns the y-coordinate of the hotspot area
 boolean isMouseOverHotspot()
          Determines whether the mouse is currently over the hotspot
 boolean isMouseOverInventHotspot()
          Determines whether the mouse is currently over an inventory hotspot
 boolean isPointInHotspot(double x, double y)
          Determines whethter the specified coordinates are within the hotspot bounds
 boolean isPointInInventHotspot(double x, double y)
          Determines whethter the specified coordinates are within the hotspot of the item in the inventory
 void render(java.awt.Graphics2D g)
          Renders hotspot things
 void setHeight(int height)
          Sets the height of the hotspot area to the specified height
 void setName(java.lang.String name)
          Sets the name of the hotspot area
 void setWidth(int width)
          Sets the width of the hotspot area to the specified width
 void setX(double x)
          Sets the x-coordinate of the hotspot area
 void setY(double y)
          Sets the y-coordinate of the hotspot area
 void showName(java.awt.Graphics2D g, boolean below)
          Shows the name of the hotspot below or above it.
 void update(double x, double y, int width, int height)
          Updates the hotspot parameters in order to be always consistent with the scene, if the hotspot area can move
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hotspot

public Hotspot(java.lang.String name,
               double x,
               double y,
               int width,
               int height,
               com.golden.gamedev.engine.BaseInput bsInput)
Creates a new hotspot with the specified parameters

Parameters:
name - name that is to be shown on the screen for the hotspot
x - x-coordinate
y - y-coordinate
width - width of the hotspot
height - height of the hotspot
bsInput -
Method Detail

getHeight

public int getHeight()
Returns the height of the hotspot area

Returns:
height of the hotspot area

setHeight

public void setHeight(int height)
Sets the height of the hotspot area to the specified height

Parameters:
height - height of the hotspot area

getName

public java.lang.String getName()
Returns the name of the hotspot area

Returns:
name of the hotspot area

setName

public void setName(java.lang.String name)
Sets the name of the hotspot area

Parameters:
name - name of the hotspot area

getWidth

public int getWidth()
Returns the width of the hotspot area

Returns:
width of the hotspot area

setWidth

public void setWidth(int width)
Sets the width of the hotspot area to the specified width

Parameters:
width - width of the hotspot area

getX

public double getX()
Returns the x-coordinate of the hotspot area

Returns:
x-coordinate of the hotspot

setX

public void setX(double x)
Sets the x-coordinate of the hotspot area

Parameters:
x - x-coordinate of the hotspot area

getY

public double getY()
Returns the y-coordinate of the hotspot area

Returns:
y-coordinate of the hotspot area

setY

public void setY(double y)
Sets the y-coordinate of the hotspot area

Parameters:
y - y-coordinate of the hotspot area

update

public void update(double x,
                   double y,
                   int width,
                   int height)
Updates the hotspot parameters in order to be always consistent with the scene, if the hotspot area can move

Parameters:
x - x-coordinate
y - y-coordinate
width - width of the hotspot area
height - height of the hotspot area

render

public void render(java.awt.Graphics2D g)
Renders hotspot things

Parameters:
g -

isMouseOverHotspot

public boolean isMouseOverHotspot()
Determines whether the mouse is currently over the hotspot

Returns:
is mouse over hotspot? --> true=yes, false=no

isMouseOverInventHotspot

public boolean isMouseOverInventHotspot()
Determines whether the mouse is currently over an inventory hotspot

Returns:
is mouse over inventory hotspot? --> true=yes, false=no

isPointInHotspot

public boolean isPointInHotspot(double x,
                                double y)
Determines whethter the specified coordinates are within the hotspot bounds

Parameters:
x - x-coordinate of the mouse
y - y-coordinate of the mouse
Returns:
is point in hotspot? --> true=yes, false=no

isPointInInventHotspot

public boolean isPointInInventHotspot(double x,
                                      double y)
Determines whethter the specified coordinates are within the hotspot of the item in the inventory

Parameters:
x - x-coordinate of the mouse
y - y-coordinate of the mouse
Returns:
is point in inventory hotspot? --> true=yes, false=no

showName

public void showName(java.awt.Graphics2D g,
                     boolean below)
Shows the name of the hotspot below or above it.

Parameters:
g -
below - show name below game object? -->true=yes, false=no