gameobjects
Class AbstractGameObject

java.lang.Object
  extended by com.golden.gamedev.object.Sprite
      extended by com.golden.gamedev.object.AnimatedSprite
          extended by gameobjects.AbstractGameObject
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<AbstractGameObject>
Direct Known Subclasses:
AbstractCharacterSprite, Item, Prop

public abstract class AbstractGameObject
extends com.golden.gamedev.object.AnimatedSprite
implements java.io.Serializable, java.lang.Comparable<AbstractGameObject>

This class is the basic class of all game objects. It contains all the methods and variables that all game objects have in common

Author:
Frank Bruns
See Also:
Serialized Form

Constructor Summary
AbstractGameObject(java.lang.String name, java.lang.String bshName, double x, double y, com.golden.gamedev.engine.BaseLoader bsLoader, com.golden.gamedev.engine.BaseInput bsInput, com.golden.gamedev.engine.BaseAudio bsSound)
          Creates a new game object with the specified name at the specified coordinates
 
Method Summary
 int compareTo(AbstractGameObject o)
           
 AnimationPool getAnimPool()
          Returns the pool of this game object's animation sequences
 AnimationScheduler getAnimScheduler()
          Returns the animation scheduler
 java.lang.String getBshName()
          Returns the beanshell name of this game object.
 com.golden.gamedev.engine.BaseLoader getBsLoader()
          Returns the base loader object
 java.lang.String getDescription()
          Deprecated. The system has no use for the method anymore
 GameLocation getGameLocation()
          Returns the game location of the game object
 Hotspot getHotspot()
          Returns the hotspot of the item
 double getMidX()
          Returns the middle x coordinate of the character
 double getMidY()
          Returns the middle y coordinate of the character
 java.lang.String getName()
          Returns the name of the game object
 boolean isPicked()
          Returns whethter this item has been picked by the player
 void render(java.awt.Graphics2D g)
           
 void setDescription(java.lang.String desc)
          Deprecated. The system has no use for the method anymore
 void setGameLocation(GameLocation loc)
          Set the game location of the game object
 void setName(java.lang.String name)
          Sets the name of the character
 void setToPicked()
          Sets the item to picked status
 void update(long elapsedTime)
           
 
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

AbstractGameObject

public AbstractGameObject(java.lang.String name,
                          java.lang.String bshName,
                          double x,
                          double y,
                          com.golden.gamedev.engine.BaseLoader bsLoader,
                          com.golden.gamedev.engine.BaseInput bsInput,
                          com.golden.gamedev.engine.BaseAudio bsSound)
Creates a new game object with the specified name at the specified coordinates

Parameters:
name - name of the game object
bshName - name that will be used for this object in beanshell scripts
x - x-coordinate
y - y-coordinate
bsLoader -
bsInput -
bsSound -
Method Detail

compareTo

public int compareTo(AbstractGameObject o)
Specified by:
compareTo in interface java.lang.Comparable<AbstractGameObject>

getMidX

public double getMidX()
Returns the middle x coordinate of the character

Returns:
middle x coordinate of the character

getMidY

public double getMidY()
Returns the middle y coordinate of the character

Returns:
middle y coordinate of the character

getBsLoader

public com.golden.gamedev.engine.BaseLoader getBsLoader()
Returns the base loader object

Returns:
base loader object

getAnimPool

public AnimationPool getAnimPool()
Returns the pool of this game object's animation sequences

Returns:
pool of animation sequences

setToPicked

public void setToPicked()
Sets the item to picked status


isPicked

public boolean isPicked()
Returns whethter this item has been picked by the player

Returns:
has been picked by the player? true=yes, false=no

setGameLocation

public void setGameLocation(GameLocation loc)
Set the game location of the game object

Parameters:
loc - game location of the game object

getGameLocation

public GameLocation getGameLocation()
Returns the game location of the game object

Returns:
game location of the game object

getName

public java.lang.String getName()
Returns the name of the game object

Returns:
name of the game object

setName

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

Parameters:
name - new name of the character

getBshName

public java.lang.String getBshName()
Returns the beanshell name of this game object. This is the name that can be used in beanshell scripts to refer to this game object.

Returns:
beanshell name of the game object

setDescription

public void setDescription(java.lang.String desc)
Deprecated. The system has no use for the method anymore

Sets the description for the game object.

Parameters:
desc - description for the item

getDescription

public java.lang.String getDescription()
Deprecated. The system has no use for the method anymore

Returns the description of the game object

Returns:
item's description

getHotspot

public Hotspot getHotspot()
Returns the hotspot of the item

Returns:
hotspot of the item

getAnimScheduler

public AnimationScheduler getAnimScheduler()
Returns the animation scheduler

Returns:
animation scheduler

update

public void update(long elapsedTime)
Overrides:
update in class com.golden.gamedev.object.AnimatedSprite

render

public void render(java.awt.Graphics2D g)
Overrides:
render in class com.golden.gamedev.object.Sprite