Skip to content

Commit

Permalink
Simplify loops in checkCollisionsWith() method
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 committed May 2, 2017
1 parent fabd696 commit 558f1f6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/ui/components/glimmeroids-app/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,9 @@ export default class Glimmeroids extends Component {
}

checkCollisionsWith(items1: Entity[], items2: Entity[]) {
let a = items1.length - 1;
let b;
for (a; a > -1; --a) {
b = items2.length - 1;
for (b; b > -1; --b) {
let item1 = items1[a];
for (let a = 0; a < items1.length; a++) {
let item1 = items1[a];
for (let b = 0; b < items2.length; b++) {
let item2 = items2[b];
if (this.checkCollision(item1, item2)) {
item1.destroy();
Expand Down

0 comments on commit 558f1f6

Please sign in to comment.