Class PreciseCollisionGroup

  extended by com.golden.gamedev.object.CollisionManager
      extended by com.golden.gamedev.object.collision.BasicCollisionGroup
          extended by com.golden.gamedev.object.collision.CollisionGroup
              extended by com.golden.gamedev.object.collision.PreciseCollisionGroup
Direct Known Subclasses:

public abstract class PreciseCollisionGroup
extends CollisionGroup

Subclass of CollisionGroup that calculate precise sprite position after collision.

Suitable for collision that need the collided object stop rather than vanish.

For example:
Collision between balls that need to stop or bounce precisely when collided with blocks.

See Also:
PlayField.addCollisionGroup(SpriteGroup, SpriteGroup, CollisionManager)

Field Summary
Fields inherited from class com.golden.gamedev.object.collision.CollisionGroup
BOTTOM_TOP_COLLISION, collisionSide, collisionX1, collisionX2, collisionY1, collisionY2, LEFT_RIGHT_COLLISION, RIGHT_LEFT_COLLISION, sprite1, sprite2, TOP_BOTTOM_COLLISION
Fields inherited from class com.golden.gamedev.object.collision.BasicCollisionGroup
pixelPerfectCollision, rect1, rect2
Constructor Summary
          Creates new collision group precise.
Method Summary
 boolean isCollide(Sprite s1, Sprite s2, CollisionShape shape1, CollisionShape shape2)
          Performs collision check between Sprite s1 and Sprite s2, and returns true if the sprites (shape1, shape2) is collided.
Methods inherited from class com.golden.gamedev.object.collision.CollisionGroup
getCollisionSide, getSprite1, getSprite2, printCollisionSide, revertPosition1, revertPosition2
Methods inherited from class com.golden.gamedev.object.collision.BasicCollisionGroup
checkCollision, collided, getCollisionShape1, getCollisionShape2
Methods inherited from class com.golden.gamedev.object.CollisionManager
getGroup1, getGroup2, getIntersectionRect, isActive, isPixelCollide, setActive, setCollisionGroup
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public PreciseCollisionGroup()
Creates new collision group precise.

Method Detail


public boolean isCollide(Sprite s1,
                         Sprite s2,
                         CollisionShape shape1,
                         CollisionShape shape2)
Performs collision check between Sprite s1 and Sprite s2, and returns true if the sprites (shape1, shape2) is collided.

PreciseCollisionGroup is tracking sprite movement step by step to check the actual position of the collision.

isCollide in class CollisionGroup
s1 - sprite from group 1
s2 - sprite from group 2
shape1 - bounding box of sprite 1
shape2 - bounding box of sprite 2
true, if the sprites is collided one another.
See Also:
CollisionGroup.collisionSide, CollisionGroup.sprite1, CollisionGroup.collisionX1, CollisionGroup.collisionY1, CollisionGroup.revertPosition1()


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