GTGE API

com.golden.gamedev.object.collision
Interface CollisionShape

All Known Implementing Classes:
CollisionRect

public interface CollisionShape

CollisionShape interface represents a form of geometric shape that behave as sprite collision area. CollisionShape is able to determine whether its area is intersected with another collision shape area.

This interface that play the role to determine whether two sprites are collided to each other or not using CollisionShape intersects(CollisionShape) method.


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.
 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(double x1, double y1, int w1, int h1)
          Sets the boundary of this colllision shape to specified boundary.
 void setLocation(double x, double y)
          Moves this collision shape to specified location.
 

Method Detail

intersects

boolean intersects(CollisionShape shape)
Returns whether this collision shape intersects with other collision shape area.


setLocation

void setLocation(double x,
                 double y)
Moves this collision shape to specified location.


move

void move(double dx,
          double dy)
Moves this collision shape by specified delta.


setBounds

void setBounds(double x1,
               double y1,
               int w1,
               int h1)
Sets the boundary of this colllision shape to specified boundary.


getX

double getX()
Returns the x-position of this collision shape.


getY

double getY()
Returns the y-position of this collision shape.


getWidth

int getWidth()
Returns the width of this collision shape.


getHeight

int getHeight()
Returns the height of this collision shape.


GTGE API

Copyright © 2003-2005 Golden T Studios. All rights reserved. Use is subject to license terms.
GoldenStudios.or.id