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

Commit c824c67

Browse files
authored
Update bloop.js
1 parent 2895cfb commit c824c67

File tree

1 file changed

+4
-4
lines changed
  • chp09_ga/NOC_9_05_EvolutionEcosystem

1 file changed

+4
-4
lines changed

chp09_ga/NOC_9_05_EvolutionEcosystem/bloop.js

Lines changed: 4 additions & 4 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 < 0) this.position.x = width-this.r/2;
75-
if (this.position.y < 0) this.position.y = height-this.r/2;
76-
if (this.position.x > width) this.position.x = this.r/2;
77-
if (this.position.y > height) this.position.y = this.r/2;
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

0 commit comments

Comments
 (0)