Skip to content
This repository was archived by the owner on Sep 22, 2024. It is now read-only.

Commit 7d93cf2

Browse files
authored
Merge pull request #110 from da091005/patch-1
Update bloop.js
2 parents 5042936 + c824c67 commit 7d93cf2

File tree

1 file changed

+5
-5
lines changed
  • chp09_ga/NOC_9_05_EvolutionEcosystem

1 file changed

+5
-5
lines changed

chp09_ga/NOC_9_05_EvolutionEcosystem/bloop.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ class Bloop {
7171

7272
// Wraparound
7373
borders() {
74-
if (this.position.x < -this.r) this.position.x = width + this.r;
75-
if (this.position.y < -this.r) this.position.y = height + this.r;
76-
if (this.position.x > this.width + this.r) this.position.x = -r;
77-
if (this.position.y > this.height + this.r) this.position.y = -r;
74+
if (this.position.x < -this.r/2) this.position.x = width+this.r/2;
75+
if (this.position.y < this.r/2) this.position.y = height+this.r/2;
76+
if (this.position.x > width+this.r/2) this.position.x = -this.r/2;
77+
if (this.position.y > height+this.r/2) this.position.y = -this.r/2;
7878
}
7979

8080
// Method to display
@@ -93,4 +93,4 @@ class Bloop {
9393
return false;
9494
}
9595
}
96-
}
96+
}

0 commit comments

Comments
 (0)