From b7dea8016b5b1328808e28b76cc12343907de63e Mon Sep 17 00:00:00 2001 From: Arnold <27396817+arngo@users.noreply.github.com> Date: Sun, 26 Dec 2021 18:39:15 -0500 Subject: 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 --- app/systems/ai/target_player.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/systems/ai/target_player.rb') diff --git a/app/systems/ai/target_player.rb b/app/systems/ai/target_player.rb index 8e715eb..1e4a3ea 100644 --- a/app/systems/ai/target_player.rb +++ b/app/systems/ai/target_player.rb @@ -1,11 +1,11 @@ FF::Sys.new("TargetPlayer", priority: 40) do - FF::Cmp::BoidsSeparation.each do |sep| - #puts 'target player'.upcase + FF::Cmp::SingletonRandomAIPick[0].entities.each do |entity| + sep = entity.components[FF::Cmp::BoidsSeparation][0] sep.distance = 200 - follow_mgr = sep.entities[0].components[FF::Cmp::Follow] + follow_mgr = entity.components[FF::Cmp::Follow] player_boid = FF::Cmp::SingletonPlayer[0].entities[0].components[FF::Cmp::Boid][0] if follow_mgr.nil? || follow_mgr.empty? - sep.entities[0].add FF::Cmp::Follow.new(target: player_boid, strength: 500) + entity.add FF::Cmp::Follow.new(target: player_boid, strength: 1.2) end end end -- cgit v1.2.3