Skip to content

Commit

Permalink
changed HitBox.setGroup to invoke functionality of interactivityChange
Browse files Browse the repository at this point in the history
  • Loading branch information
SergiusIW committed Apr 20, 2014
1 parent 208ce1c commit 302c4c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion collider/src/com/matthewmichelotti/collider/Collider.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ void processCurHBAndCollision(boolean checkReiterate) {
testId++;
if(checkReiterate) checkForReiteration();
int newGroup = curHitBox.getGroup();
if(newGroup != oldGroup) changeInteractivity = true;
if(newGroup != oldGroup && !changeInteractivity) throw new RuntimeException();
for(HitBox b : overlapSetPool.iterator(curHitBox.overlapSet)) {
if(!b.testMark(testId)) throw new RuntimeException();
if(newGroup < 0 || (changeInteractivity && !interactTester.canInteract(curHitBox, b))) {
Expand Down
5 changes: 3 additions & 2 deletions collider/src/com/matthewmichelotti/collider/HitBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ final boolean testMark(int testId) {
* Default group is 0.
* The value -1 denotes that this HitBox does not belong to any group
* and thus is never tested for collisions.
* This method will also invoke the functionality of
* {@link #interactivityChange()}.
* <p>
* Collision testing will only be performed on HitBoxes of the groups
* specified by the {@link InteractTester#getInteractGroups(HitBox, com.badlogic.gdx.utils.IntArray)}
Expand All @@ -132,11 +134,10 @@ final boolean testMark(int testId) {
* -1 and {@link #NUM_GROUPS}-1 inclusive. The value -1 denotes not belonging to any group.
*/
public final void setGroup(int group) {
if(this.group == group) return;
if(group < -1 || group >= NUM_GROUPS) {
throw new IllegalArgumentException("invalid group:" + group);
}
collider.altering(this);
collider.altering(this, true);
this.group = group;
}

Expand Down

0 comments on commit 302c4c5

Please sign in to comment.