|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.golden.gamedev.object.Sprite
com.golden.gamedev.object.AnimatedSprite
gameobjects.AbstractGameObject
gameobjects.item.Item
public class Item
This class represents an item in the game. Items are objects with which the player can interact in some way.
Constructor Summary | |
---|---|
Item(java.lang.String name,
java.lang.String bshName,
double x,
double y,
boolean pickable,
java.awt.image.BufferedImage inventImage,
com.golden.gamedev.engine.BaseLoader bsLoader,
com.golden.gamedev.engine.BaseInput bsInput,
com.golden.gamedev.engine.BaseAudio bsSound)
Creates a new item |
Method Summary | |
---|---|
Hotspot |
getInventHotspot()
Returns the hotspot of the item in the inventory |
java.awt.image.BufferedImage |
getInventoryImage()
Returns the image that represents the item in the inventory |
java.awt.Point |
getInventPosition()
Returns the current position of the item in the inventory. |
java.lang.String |
getItemName()
Returns the name of an item |
boolean |
isInPickingRange(Player player)
Determines whether the item is within picking range of the player character |
boolean |
isNotedForPicking()
Determines whether the item is noted for later picking, so that the item can be picked as soon as the player gets near to it |
boolean |
isPickable()
Determines whether the item be picked by the player |
void |
setInventPosition(java.awt.Point point)
Sets the inventory position of the item to the specified point |
void |
setNotedForPicking(boolean noted)
Sets if the item is noted for picking as soon as the player gets near the item |
void |
showNameinInventory(java.awt.Graphics2D g)
Shows the name of the inventory item right below it. |
void |
update(long elapsedTime)
|
Methods inherited from class gameobjects.AbstractGameObject |
---|
compareTo, getAnimPool, getAnimScheduler, getBshName, getBsLoader, getDescription, getGameLocation, getHotspot, getMidX, getMidY, getName, isPicked, render, setDescription, setGameLocation, setName, setToPicked |
Methods inherited from class com.golden.gamedev.object.AnimatedSprite |
---|
getAnimationTimer, getFinishAnimationFrame, getFrame, getImage, getImage, getImages, getStartAnimationFrame, isAnimate, isLoopAnim, render, setAnimate, setAnimationFrame, setAnimationTimer, setFrame, setImage, setImages, setLoopAnim |
Methods inherited from class com.golden.gamedev.object.Sprite |
---|
addHorizontalSpeed, addVerticalSpeed, forceX, forceY, getBackground, getDataID, getDistance, getHeight, getHorizontalSpeed, getID, getLayer, getOldX, getOldY, getScreenX, getScreenY, getVerticalSpeed, getWidth, getX, getY, isActive, isImmutable, isOnScreen, isOnScreen, move, moveTo, moveX, moveY, setActive, setBackground, setDataID, setHorizontalSpeed, setID, setImmutable, setLayer, setLocation, setMovement, setSpeed, setVerticalSpeed, setX, setY |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Item(java.lang.String name, java.lang.String bshName, double x, double y, boolean pickable, java.awt.image.BufferedImage inventImage, com.golden.gamedev.engine.BaseLoader bsLoader, com.golden.gamedev.engine.BaseInput bsInput, com.golden.gamedev.engine.BaseAudio bsSound)
name
- name of the itembshName
- name that will be used for this item in
beanshell scriptsx
- x-coordinatey
- y-coordinatepickable
- is the item pickable by the player?inventImage
- image for the inventorybsLoader
- bsInput
- bsSound
- Method Detail |
---|
public java.lang.String getItemName()
public java.awt.Point getInventPosition()
null
if the item is not pickable and hence could not
have become a member of the inventory.
public void setInventPosition(java.awt.Point point)
point
- new position in the inventorypublic java.awt.image.BufferedImage getInventoryImage()
public Hotspot getInventHotspot()
public boolean isPickable()
public void setNotedForPicking(boolean noted)
noted
- note the item for later picking --> true=yes, false=nopublic boolean isNotedForPicking()
public boolean isInPickingRange(Player player)
player
- player object
public void showNameinInventory(java.awt.Graphics2D g)
g
- public void update(long elapsedTime)
update
in class AbstractGameObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |