From 5db81eb137cb8586c9bf77e8ece27f80894ba139 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 20 Jun 2002 00:54:53 +0000 Subject: [PATCH] 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 --- .../threerings/media/sprite/SpriteManager.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/java/com/threerings/media/sprite/SpriteManager.java b/src/java/com/threerings/media/sprite/SpriteManager.java index 1bd7c2964..b5a3e3280 100644 --- a/src/java/com/threerings/media/sprite/SpriteManager.java +++ b/src/java/com/threerings/media/sprite/SpriteManager.java @@ -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; @@ -180,8 +180,8 @@ public class SpriteManager // re-sort the sprite list to account for potential new positions _sprites.sort(SPRITE_COMP); - // notify sprite observers of any collisions - handleCollisions(); +// // notify sprite observers of any collisions +// handleCollisions(); // notify sprite observers of any sprite events. note that we // explicitly queue up events while ticking and checking for @@ -257,25 +257,23 @@ public class SpriteManager return; } - // calculate the x-position of the right edge of the sprite - // we're checking for collisions + // calculate the x-position of the right edge of the sprite we're + // checking for collisions Rectangle bounds = sprite.getBounds(); int edgeX = bounds.x + bounds.width; for (int ii = (idx + 1); ii < size; ii++) { Sprite other = (Sprite)_sprites.get(ii); Rectangle obounds = other.getBounds(); - if (obounds.x > edgeX) { // since sprites are stored in the list sorted by // ascending x-position, we know this sprite and any // other sprites farther on in the list can't possibly // intersect with the sprite we're checking, so we're // done. - return; - } + return; - if (obounds.intersects(bounds)) { + } else if (obounds.intersects(bounds)) { sprite.notifyObservers(new CollisionEvent(sprite, other)); } }