wyvern.lib.classes.games.SideScroller
Class Platform

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.maps.MapObject
          extended bywyvern.lib.classes.games.SideScroller.Platform
All Implemented Interfaces:
Broadcaster, GameObject, MethodHookable, PropertyList, Timed

public class Platform
extends MapObject
implements Timed

A sidescroller platform that moves back and forth.

Version:
1.0, 8/17/2002
Author:
Kiz

Field Summary
static int DEFAULT_RATE
          Default speed at which the platform travels
protected  int direction_
          Direction of movement
protected  int interval_
           
protected  SideScroller scroller_
           
protected  java.util.ArrayList tempList_
           
protected  SuspendableTimer timer_
          Timer for movement
 
Fields inherited from class wyvern.kernel.maps.MapObject
IN_MAP_EDITOR, listenerList_
 
Fields inherited from class wyvern.kernel.properties.PList
readOnly_
 
Fields inherited from interface wyvern.lib.PropertyList
PROPERTY_PACKAGE
 
Constructor Summary
Platform()
           
 
Method Summary
 void bounce()
          Change to a different direction.
 boolean canGoUp(GameMap map, Point p)
          Can we move up?
 void destroy()
          Destroys the object.
 GameObject getBlocker(GameMap map, int x, int y)
          Find any blocking object in this location
 GameObject getBlocker(GameMap map, Point p)
          Find any blocking object in this location
 void initialize()
          Sets initial properties.
 java.util.List makeLocalCopy(java.util.List orig)
          Make a local copy of a list.
 GameObject move()
          Move a square forward.
 void moveOccupants(Point p, Point dir)
          Move anyone sitting on top, too.
 void setMap(GameMap map, int x, int y)
          We've been put in a map.
 void start()
          Start it up
 void stop()
          Stop it
 void timerExpired()
          Time to move.
 
Methods inherited from class wyvern.kernel.maps.MapObject
addContainerChangeListener, addDefaultProperty, addMapChangeListener, addMapMotionListener, addMethodHook, addMotionTracker, addObjectTracker, addPrefix, addSuffix, addToMap, bless, broadcast, broadcast, broadcast, broadcast, broadcast, canEnter, canEnterBlockedBy, canMove, canMove, canMoveBlockedBy, canMoveBlockedBy, canMoveTo, canMoveToBlockedBy, checkDrop, curse, cycleFrame, ensureListenerList, ensureWeight, externalize, fireContainerEntered, fireContainerExited, fireEnteredMap, fireExitedMap, fireMovedInMap, getAlpha, getAppearance, getArchetype, getBaseName, getBaseWeight, getBitmap, getBounds, getCanonicalClassName, getCategory, getContainer, getCreator, getDamagedDescription, getDescription, getDirection, getGenderPossessive, getGenderPronoun, getImage, getImageDescriptor, getImageDescriptors, getLayer, getLocations, getMap, getMapLink, getMaterial, getMaterialDescription, getMover, getOwningPlayer, getParentMap, getPrefixes, getQuantity, getReferenceLoc, getRelativeLocs, getShortDesc, getSuffixes, getTile, getTile, getValue, getWeight, groupString, inContainer, initLocs, inMapEditor, invalidate, invalidateImage, invalidateParent, invalidateText, isAnimated, isAttackable, isBlessed, isCommandable, isCursed, isDamned, isGroupable, isIdentified, isMonster, isMonsterOrPlayer, isPlayer, isTerrain, isUncursed, isUnpaid, isWizard, makeClone, markPaid, markUnpaid, move, occupies, positionAt, positionAtMap, remove, removeContainerChangeListener, removeFromMap, removeMapChangeListener, removeMapMotionListener, removeMethodHook, removeMotionTracker, removeObjectTracker, removePrefix, removeSuffix, runMethodHook, setAlpha, setAnimated, setBitmap, setCategory, setContainer, setDefaultBitmap, setDefaultCategory, setDefaultDesc, setDefaultImage, setDefaultIntProperty, setDefaultLayer, setDefaultMaterial, setDefaultProperty, setDefaultShortDesc, setDirection, setImage, setImage, setLayer, setLocations, setMapLink, setQuantity, setShape, setSize, setTransientSize, setWeight, setWeight, teleport, toString, updateMapLocation
 
Methods inherited from class wyvern.kernel.properties.PList
addProperty, addTransientProperty, adjustDoubleProperty, adjustIntProperty, adjustLongProperty, adjustTransientDoubleProperty, adjustTransientIntProperty, adjustTransientLongProperty, countLocalProperties, debugProperties, dismantlePropertyList, getDoubleProperty, getInheritedProperty, getInteger, getIntProperty, getLocalProperties, getLocalProperty, getLongProperty, getParent, getPersistentDoubleProperty, getPersistentIntProperty, getPersistentLocalProperties, getPersistentLongProperty, getPersistentProperty, getProfilingInfo, getProperties, getProperties, getPropertiesIncludingTransients, getPropertiesIncludingTransients, getProperty, getSerializableProperties, getSerializableProperty, getStringProperty, getTransientDoubleProperty, getTransientIntProperty, getTransientLongProperty, getTransientProperties, getTransientProperty, hasLocalProperty, hasPersistentProperty, hasProperty, hasTransientProperty, inheritProperty, isReadOnly, isRemoved, isTransientlyRemoved, printLocalProperties, printProperties, printProperties, printTransientProperties, removeProperty, removeTransientProperty, setDoubleProperty, setIntProperty, setLongProperty, setParent, setProperty, setReadOnly, setTransientDoubleProperty, setTransientIntProperty, setTransientLongProperty, setTransientProperty, toString, transientlyRemoveProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface wyvern.lib.PropertyList
addProperty, addTransientProperty, adjustDoubleProperty, adjustIntProperty, adjustLongProperty, adjustTransientDoubleProperty, adjustTransientIntProperty, adjustTransientLongProperty, countLocalProperties, getDoubleProperty, getInheritedProperty, getIntProperty, getLocalProperties, getLocalProperty, getLongProperty, getParent, getPersistentDoubleProperty, getPersistentIntProperty, getPersistentLocalProperties, getPersistentLongProperty, getPersistentProperty, getProperties, getProperties, getPropertiesIncludingTransients, getPropertiesIncludingTransients, getProperty, getSerializableProperties, getSerializableProperty, getStringProperty, getTransientDoubleProperty, getTransientIntProperty, getTransientLongProperty, getTransientProperties, getTransientProperty, hasLocalProperty, hasPersistentProperty, hasProperty, hasTransientProperty, inheritProperty, isReadOnly, isRemoved, isTransientlyRemoved, printLocalProperties, printProperties, printProperties, printTransientProperties, removeProperty, removeTransientProperty, setDoubleProperty, setIntProperty, setLongProperty, setParent, setProperty, setReadOnly, setTransientDoubleProperty, setTransientIntProperty, setTransientLongProperty, setTransientProperty, toString, transientlyRemoveProperty
 

Field Detail

DEFAULT_RATE

public static final int DEFAULT_RATE
Default speed at which the platform travels

See Also:
Constant Field Values

timer_

protected SuspendableTimer timer_
Timer for movement


direction_

protected int direction_
Direction of movement


scroller_

protected SideScroller scroller_

interval_

protected int interval_

tempList_

protected java.util.ArrayList tempList_
Constructor Detail

Platform

public Platform()
Method Detail

initialize

public void initialize()
Sets initial properties.

Specified by:
initialize in interface GameObject
Overrides:
initialize in class MapObject

setMap

public void setMap(GameMap map,
                   int x,
                   int y)
We've been put in a map. Start the timer.

Specified by:
setMap in interface GameObject
Overrides:
setMap in class MapObject

start

public void start()
Start it up


stop

public void stop()
Stop it


timerExpired

public void timerExpired()
Time to move.

Specified by:
timerExpired in interface Timed

move

public GameObject move()
Move a square forward. If blocked, return the blocking object.


canGoUp

public boolean canGoUp(GameMap map,
                       Point p)
Can we move up? Up is a problematic direction that requires special handling. We have to check whether the objects above us can be pushed upwards.

Parameters:
map - the map
p - starting point (our reference location: left side)

moveOccupants

public void moveOccupants(Point p,
                          Point dir)
Move anyone sitting on top, too. But this won't prevent us from moving, even if they don't.

Parameters:
dir - the direction we moved

getBlocker

public GameObject getBlocker(GameMap map,
                             int x,
                             int y)
Find any blocking object in this location

Parameters:
map - the map
x - x-loc
y - y-loc

getBlocker

public GameObject getBlocker(GameMap map,
                             Point p)
Find any blocking object in this location

Parameters:
map - the map
p - map location

makeLocalCopy

public java.util.List makeLocalCopy(java.util.List orig)
Make a local copy of a list. Necessary because getObjectsAt returns the REAL list, so any changes made will change it. We don't need that headache.


bounce

public void bounce()
Change to a different direction.


destroy

public void destroy()
Destroys the object.

Specified by:
destroy in interface GameObject
Overrides:
destroy in class MapObject