fang
Class RectangleSprite

java.lang.Object
  extended by fang.Sprite
      extended by fang.RectangleSprite

public class RectangleSprite
extends Sprite

This class represents a rectangular sprite.

Author:
Jam Jenkins

Field Summary
 
Fields inherited from class fang.Sprite
color, config, DEBUG_BOUNDING_BOX, DEBUG_INTERSECTS, debugBoundingBoxColor, image, optimizeForBitmap, shape, tracker, transform
 
Constructor Summary
RectangleSprite(double width, double height)
          makes a rectangular sprite.
 
Method Summary
 boolean intersects(double ptX, double ptY)
          determines if a point is within the sprite's shape
 
Methods inherited from class fang.Sprite
addTransformer, advanceTime, bounceOffOf, disableTransformer, drawDebugShapes, enableTransformer, forward, getBlurLength, getBounds2D, getColor, getDebug, getDebugBoundingBoxColor, getDefaultColor, getHeight, getLocation, getMaxX, getMaxY, getMinX, getMinY, getNormalVector, getNormalVector, getOptimizedForBitmap, getOrientation, getOrientationDegrees, getOrientationRadians, getOrientationRevolutions, getRotation, getRotationDegrees, getRotationRadians, getRotationRevolutions, getScale, getShape, getSize, getTracker, getUseBoundingBox, getWidth, getX, getY, hasTracker, hide, intersects, intersects, intersects, intersects, isDestroyed, isEnabled, isVisible, normalize, paint, paintInternal, paintShape, removeAllTrackers, removeFromCanvas, removeTransformer, rotate, rotateDegrees, rotateRadians, rotateRevolutions, scale, setAbsoluteShape, setBlurLength, setColor, setDebug, setDebugBoundingBoxColor, setDebugBrush, setDefaultColor, setEnabled, setLocation, setLocation, setLocation, setOptimizedForBitmap, setOrientation, setOrientationDegrees, setOrientationRadians, setOrientationRevolutions, setRotation, setRotationDegrees, setRotationRadians, setRotationRevolutions, setScale, setShape, setSize, setTracker, setUseBoundingBox, setVisible, setX, setY, show, translate, translate, translate, translateX, translateY, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RectangleSprite

public RectangleSprite(double width,
                       double height)
makes a rectangular sprite. The magnitude of the width and height only matter with respect to each other. For example, a RectangleSprite constructed with a width 2 and height 1 is the same as making the width 20 and the height 10 because they both have the same height/width aspect ratio of 2.

Parameters:
width - the horizontal span
height - the vertical span
Method Detail

intersects

public boolean intersects(double ptX,
                          double ptY)
determines if a point is within the sprite's shape

Overrides:
intersects in class Sprite
Parameters:
ptX - x-coordinate of the point to test
ptY - y-coordinate of the point to test
Returns:
true if point is in the shape, false otherwise