summaryrefslogtreecommitdiffhomepage
path: root/app/systems/ai/scatter.rb
diff options
context:
space:
mode:
authorArnold <[email protected]>2021-12-26 18:39:15 -0500
committerGitHub <[email protected]>2021-12-26 18:39:15 -0500
commitb7dea8016b5b1328808e28b76cc12343907de63e (patch)
tree5339c23bbde03c4d6c8c79d96b2033ab9e838ec0 /app/systems/ai/scatter.rb
parentf70283e5ad5f5a5744ca0695a184f72f88803aca (diff)
downloadSteelWings-b7dea8016b5b1328808e28b76cc12343907de63e.tar.gz
SteelWings-b7dea8016b5b1328808e28b76cc12343907de63e.zip
implement ai randomizer, gameover screen, and other bug fixes
* Cleaned up factory. Fixed most bugs with death(last bug should be with move camera). * check if player entity is nil before shooting or moving camera * implement ai randomizer * separate button click detection to new system * implement gameover screen with button to return to menu * use reverse_each instead of cloning Co-authored-by: realtradam <[email protected]>
Diffstat (limited to 'app/systems/ai/scatter.rb')
-rw-r--r--app/systems/ai/scatter.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/app/systems/ai/scatter.rb b/app/systems/ai/scatter.rb
index 1469fd9..82bcb65 100644
--- a/app/systems/ai/scatter.rb
+++ b/app/systems/ai/scatter.rb
@@ -1,10 +1,15 @@
FF::Sys.new("Scatter", priority: 40) do
- FF::Cmp::BoidsSeparation.each do |sep|
- sep.distance = 200
+ FF::Cmp::SingletonRandomAIPick[0].entities.each do |entity|
+ sep = entity.components[FF::Cmp::BoidsSeparation][0]
+ # I did times 3 becase then it will always be greater then
+ # what it was before and that means it will force a
+ # seperation to happen even if the default value is
+ # changed and you forget to update this number here
+ sep.distance = Factory::SampleEnemy.defaults[:boids_seperation_distance] * 3
#puts 'remove align/cohesion/follow'.upcase
- alignment_mgr = sep.entities[0].components[FF::Cmp::BoidsAlignment]
- cohesion_mgr = sep.entities[0].components[FF::Cmp::BoidsCohesion]
- follow_mgr = sep.entities[0].components[FF::Cmp::Follow]
+ alignment_mgr = entity.components[FF::Cmp::BoidsAlignment]
+ cohesion_mgr = entity.components[FF::Cmp::BoidsCohesion]
+ follow_mgr = entity.components[FF::Cmp::Follow]
unless follow_mgr.nil? || follow_mgr.empty?
follow_mgr[0].delete
end