summaryrefslogtreecommitdiffhomepage
path: root/app/systems/ai/target_player.rb
blob: 8e715eb7673779a9887926829676dbe25ba02d12 (plain)
1
2
3
4
5
6
7
8
9
10
11
FF::Sys.new("TargetPlayer", priority: 40) do
  FF::Cmp::BoidsSeparation.each do |sep|
    #puts 'target player'.upcase
    sep.distance = 200
    follow_mgr = sep.entities[0].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)
    end
  end
end