summaryrefslogtreecommitdiffhomepage
path: root/app/systems/death.rb
diff options
context:
space:
mode:
author_Tradam <[email protected]>2021-12-19 19:08:50 -0500
committerGitHub <[email protected]>2021-12-19 19:08:50 -0500
commitcd3d7be54f16263ceaa9b5e0e8a1c219821e8339 (patch)
tree86014a919be2ee016472d9243a213c1c5659668d /app/systems/death.rb
parentc16f16066f1943a8c2d4178583578705e71e7794 (diff)
parent844d8c194b48055ba60be4d185ad9ab688cce92a (diff)
downloadSteelWings-cd3d7be54f16263ceaa9b5e0e8a1c219821e8339.tar.gz
SteelWings-cd3d7be54f16263ceaa9b5e0e8a1c219821e8339.zip
Merge pull request #3 from realtradam/dmg-dev
Bullets, Health, Collision systems implemented. Renamed plane sprites.
Diffstat (limited to 'app/systems/death.rb')
-rw-r--r--app/systems/death.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/systems/death.rb b/app/systems/death.rb
new file mode 100644
index 0000000..d9cd792
--- /dev/null
+++ b/app/systems/death.rb
@@ -0,0 +1,20 @@
+FF::Scn::BoidRules.add(
+ FF::Sys.new("Death", priority: 200) do
+ FF::Cmp::Hp.each do |hp|
+ if hp.health <= 0
+ component_hash = hp.entities[0].components.clone
+ component_hash.each_pair do |manager, manager_array|
+ next if manager.equal?(FF::Cmp::SingletonCamera)
+ next if manager.equal?(FF::Cmp::Hp)
+ next if manager.equal?(FF::Cmp::DebugVectorArrow)
+ manager_array.each do |component|
+ # unless singleton
+ component.delete
+ end
+ end
+ hp.entities[0].delete
+ hp.delete
+ end
+ end
+ end
+)