Don't check for sprite collisions presently. We'll have to revisit this

when we actually want to use the collision support.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1503 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-06-20 00:54:53 +00:00
parent d18ce7a79d
commit 5db81eb137
@@ -1,5 +1,5 @@
// //
// $Id: SpriteManager.java,v 1.31 2002/06/18 22:25:33 mdb Exp $ // $Id: SpriteManager.java,v 1.32 2002/06/20 00:54:53 mdb Exp $
package com.threerings.media.sprite; package com.threerings.media.sprite;
@@ -180,8 +180,8 @@ public class SpriteManager
// re-sort the sprite list to account for potential new positions // re-sort the sprite list to account for potential new positions
_sprites.sort(SPRITE_COMP); _sprites.sort(SPRITE_COMP);
// notify sprite observers of any collisions // // notify sprite observers of any collisions
handleCollisions(); // handleCollisions();
// notify sprite observers of any sprite events. note that we // notify sprite observers of any sprite events. note that we
// explicitly queue up events while ticking and checking for // explicitly queue up events while ticking and checking for
@@ -257,25 +257,23 @@ public class SpriteManager
return; return;
} }
// calculate the x-position of the right edge of the sprite // calculate the x-position of the right edge of the sprite we're
// we're checking for collisions // checking for collisions
Rectangle bounds = sprite.getBounds(); Rectangle bounds = sprite.getBounds();
int edgeX = bounds.x + bounds.width; int edgeX = bounds.x + bounds.width;
for (int ii = (idx + 1); ii < size; ii++) { for (int ii = (idx + 1); ii < size; ii++) {
Sprite other = (Sprite)_sprites.get(ii); Sprite other = (Sprite)_sprites.get(ii);
Rectangle obounds = other.getBounds(); Rectangle obounds = other.getBounds();
if (obounds.x > edgeX) { if (obounds.x > edgeX) {
// since sprites are stored in the list sorted by // since sprites are stored in the list sorted by
// ascending x-position, we know this sprite and any // ascending x-position, we know this sprite and any
// other sprites farther on in the list can't possibly // other sprites farther on in the list can't possibly
// intersect with the sprite we're checking, so we're // intersect with the sprite we're checking, so we're
// done. // done.
return; return;
}
if (obounds.intersects(bounds)) { } else if (obounds.intersects(bounds)) {
sprite.notifyObservers(new CollisionEvent(sprite, other)); sprite.notifyObservers(new CollisionEvent(sprite, other));
} }
} }