location
Class InteractiveHotspot

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

public class InteractiveHotspot
extends Hotspot

This class represents an interactive hotspot. That is an extension to a normal hotspot. Normal hotspot usually are used together with game objects in order to make them sensitive to mouse movements. Now an interactive hotspot is a hotspot especially designed to exit stand alone at the game location. That means there is no need to connect it to a game object. The user can perform actions on the hotspot directly, for example via beanshell scripts. The following example may explain this a little further. Imagine a lock that can be opened by certain key. Because you don't want to take the overhead of placeing an item that represents the lock in a door, you can easily setup an interactive hotspot at the place of the look to make it sensitive for actions by the player.

Author:
Frank Bruns
See Also:
Serialized Form

Constructor Summary
InteractiveHotspot(java.lang.String name, java.lang.String bshName, double x, double y, int width, int height, com.golden.gamedev.engine.BaseInput bsInput, com.golden.gamedev.engine.BaseLoader bsLoader)
          Creates a new hotspot with the specified parameters
 
Method Summary
 java.lang.String getBshName()
          Returns the beanshell name for this interactive hotspot
 boolean isActive()
          Determines whether the interactive hotspot is active.
 void render(java.awt.Graphics2D g)
          Renders the interactive hotspot name
 void setActive()
          Sets the interactive hotspot to active state if it was not active before
 void setImage(java.awt.image.BufferedImage img)
          Sets the assigned image of the interactive hotspot to the specified image
 void setImage(java.lang.String imagePath)
          Sets the image assigned to the interactive hotspot
 void setInactive()
          Sets the interactive hotspot to inactive state.
 
Methods inherited from class location.Hotspot
getHeight, getName, getWidth, getX, getY, isMouseOverHotspot, isMouseOverInventHotspot, isPointInHotspot, isPointInInventHotspot, 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

InteractiveHotspot

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

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

getBshName

public java.lang.String getBshName()
Returns the beanshell name for this interactive hotspot

Returns:
name for adressing this hotspot in beanshell script files

isActive

public boolean isActive()
Determines whether the interactive hotspot is active.

Returns:
is interactive hotpsot active? --> true=yes, false=no

setInactive

public void setInactive()
Sets the interactive hotspot to inactive state. You can do this for example if the hotspot was used with the correct item and isn't needed for explicit user interaction anymore


setActive

public void setActive()
Sets the interactive hotspot to active state if it was not active before


setImage

public void setImage(java.awt.image.BufferedImage img)
Sets the assigned image of the interactive hotspot to the specified image

Parameters:
img - image to assign to the interactive hotspot

setImage

public void setImage(java.lang.String imagePath)
Sets the image assigned to the interactive hotspot

Parameters:
imagePath - path+filename of the image to set

render

public void render(java.awt.Graphics2D g)
Renders the interactive hotspot name

Overrides:
render in class Hotspot
Parameters:
g -