summaryrefslogtreecommitdiffhomepage
path: root/app/systems/rules/cohesion.rb
diff options
context:
space:
mode:
author_Tradam <[email protected]>2021-12-23 03:39:35 -0500
committerGitHub <[email protected]>2021-12-23 03:39:35 -0500
commitf70283e5ad5f5a5744ca0695a184f72f88803aca (patch)
treef9a182ccbc6ade03524f70f4483244a2e86ae6d1 /app/systems/rules/cohesion.rb
parent18f869d18fac469e44f9a6a4772494a262c1b0cb (diff)
downloadSteelWings-f70283e5ad5f5a5744ca0695a184f72f88803aca.tar.gz
SteelWings-f70283e5ad5f5a5744ca0695a184f72f88803aca.zip
cleaned up boid rules, changed how strength works (#8)
Diffstat (limited to 'app/systems/rules/cohesion.rb')
-rw-r--r--app/systems/rules/cohesion.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/systems/rules/cohesion.rb b/app/systems/rules/cohesion.rb
index 7e33961..6347a39 100644
--- a/app/systems/rules/cohesion.rb
+++ b/app/systems/rules/cohesion.rb
@@ -10,7 +10,7 @@ FF::Scn::BoidRules.add(
#puts boid.x
#puts boid.y
end
-
+
#puts center_mass
FF::Cmp::BoidsCohesion.each do |cohesion|
boid_update = cohesion.entities[0].components[FF::Cmp::Boid][0]
@@ -20,8 +20,8 @@ FF::Scn::BoidRules.add(
move_boid[0] /= boids_count - 1.0
move_boid[1] /= boids_count - 1.0
- boid_update.cx += (move_boid[0] - boid_update.x) / cohesion.strength.to_i
- boid_update.cy += (move_boid[1] - boid_update.y) / cohesion.strength.to_i
+ boid_update.cx += (move_boid[0] - boid_update.x) * cohesion.strength.to_i
+ boid_update.cy += (move_boid[1] - boid_update.y) * cohesion.strength.to_i
end
end
)