|
GTGE API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.golden.gamedev.object.collision.CollisionRect
public class CollisionRect
Optimized java.awt.Rectangle
with double precision. The default
sprite collision bounding box.
Field Summary | |
---|---|
int |
height
The height of this collision rect. |
int |
width
The width of this collision rect. |
double |
x
The x -coordinate of this collision rect. |
double |
y
The y -coordinate of this collision rect. |
Constructor Summary | |
---|---|
CollisionRect()
Creates new CollisionRect . |
Method Summary | |
---|---|
int |
getHeight()
Returns the height of this collision shape. |
int |
getWidth()
Returns the width of this collision shape. |
double |
getX()
Returns the x -position of this collision shape. |
double |
getY()
Returns the y -position of this collision shape. |
void |
grow(int h,
int v)
Grows this collision rect by h width,
and v height. |
boolean |
intersects(CollisionShape shape)
Returns whether this collision shape intersects with other collision shape area. |
void |
move(double dx,
double dy)
Moves this collision shape by specified delta. |
void |
setBounds(CollisionRect rect)
Sets the boundary of this colllision rect to be same with specified collision rect. |
void |
setBounds(double x1,
double y1,
int w1,
int h1)
Sets the boundary of this colllision shape to specified boundary. |
void |
setLocation(double x1,
double y1)
Moves this collision shape to specified location. |
void |
shrink(int h,
int v)
Shrinks this collision rect by h width,
and v height. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public double x
x
-coordinate of this collision rect.
public double y
y
-coordinate of this collision rect.
public int width
public int height
Constructor Detail |
---|
public CollisionRect()
CollisionRect
.
Method Detail |
---|
public void grow(int h, int v)
h
width,
and v
height.
public void shrink(int h, int v)
h
width,
and v
height.
public boolean intersects(CollisionShape shape)
CollisionShape
intersects
in interface CollisionShape
public void setBounds(double x1, double y1, int w1, int h1)
CollisionShape
setBounds
in interface CollisionShape
public void setBounds(CollisionRect rect)
public void setLocation(double x1, double y1)
CollisionShape
setLocation
in interface CollisionShape
public void move(double dx, double dy)
CollisionShape
move
in interface CollisionShape
public double getX()
CollisionShape
x
-position of this collision shape.
getX
in interface CollisionShape
public double getY()
CollisionShape
y
-position of this collision shape.
getY
in interface CollisionShape
public int getWidth()
CollisionShape
getWidth
in interface CollisionShape
public int getHeight()
CollisionShape
getHeight
in interface CollisionShape
public String toString()
toString
in class Object
|
GTGE API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |