Skip to content

Commit

Permalink
Fix integer bin partition strategy.
Browse files Browse the repository at this point in the history
  • Loading branch information
njd5475 committed May 21, 2016
1 parent 4e09bed commit e62a176
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/com/zealouscoder/ld35/GameState.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,11 @@ public Set<Entry<Integer, Set<Renderable>>> getRenderables() {

public Renderable[] neighbors(GenericGameObject go, GamePosition update) {
Set<Renderable> nearbys = new HashSet<Renderable>();
int count = 0;
for (Renderable r : strategy.get(update, go.getBounds())) {
++count;
if (isClose(r, go.getPosition()) && r != go) {
nearbys.add(r);
}
}
System.out.println(count);
return nearbys.toArray(new Renderable[nearbys.size()]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ private Integer[] getBins(GamePosition pos, GameObjectBound bound) {
int left = (int) (pos.getX() / binSize);
int right = (int) ((pos.getX() + bound.getWidth()) / binSize);

for (int x = left; x < right; ++x) {
for (int y = top; y < bottom; ++y) {
for (int x = left; x <= right; ++x) {
for (int y = top; y <= bottom; ++y) {
bins.add(getBin(x, y));
}
}
Expand Down

0 comments on commit e62a176

Please sign in to comment.