Class SRVector
java.lang.Object
|
+----java.util.Vector
|
+----SpriteVector
|
+----SRVector
- public class SRVector
- extends SpriteVector
This class extends the SpriteVector class and overrides the methods
"isPointInside" and "collision". This allows the program to distinguish
which Sprite is being clicked (because of z-order it would by default
indicate the "gun" Sprite) and eliminate Sprite collision detection.
This class is taken directly from the book "Teach yourself
Internet Game Programming with Java in 21 days" by Michael Morrison.
See chapter 13 for details.
-
SRVector(Background)
-
-
collision(int, int)
- None of the Sprites need collision handling so this
method is overridden to do nothing.
-
isPointInside(Point)
- This method is necessary to determine when and "Eye" class
has been clicked by the mouse otherwise because of the z-ordering
of bitmap images the "gun" image would always be returned.
SRVector
public SRVector(Background back)
isPointInside
Sprite isPointInside(Point pt)
- This method is necessary to determine when and "Eye" class
has been clicked by the mouse otherwise because of the z-ordering
of bitmap images the "gun" image would always be returned.
- Overrides:
- isPointInside in class SpriteVector
collision
protected boolean collision(int i,
int iHit)
- None of the Sprites need collision handling so this
method is overridden to do nothing.
- Overrides:
- collision in class SpriteVector