summaryrefslogtreecommitdiffhomepage
path: root/app/systems
diff options
context:
space:
mode:
Diffstat (limited to 'app/systems')
-rw-r--r--app/systems/cleanup_bullets.rb11
-rw-r--r--app/systems/start_game.rb1
2 files changed, 12 insertions, 0 deletions
diff --git a/app/systems/cleanup_bullets.rb b/app/systems/cleanup_bullets.rb
new file mode 100644
index 0000000..7055de4
--- /dev/null
+++ b/app/systems/cleanup_bullets.rb
@@ -0,0 +1,11 @@
+FF::Scn::Cleanup.add(
+ FF::Sys.new('CleanupBullets', priority: 99) do
+ FF::Cmp::SingletonBullet[0].entities.each do |ent|
+ sprite = ent.components[FF::Cmp::Sprite][0].props
+ hp = ent.components[FF::Cmp::Hp][0]
+ if sprite.x < 0 or sprite.x > $gtk.args.grid.w or sprite.y < 0 or sprite.y > $gtk.args.grid.h
+ hp.health = -1
+ end
+ end
+ end
+)
diff --git a/app/systems/start_game.rb b/app/systems/start_game.rb
index 51f26d4..e329d1d 100644
--- a/app/systems/start_game.rb
+++ b/app/systems/start_game.rb
@@ -53,6 +53,7 @@ FF::Sys.new('StartGame', priority: 50 ) do
FF::Stg.add(
FF::Scn::BoidRules,
FF::Scn::Camera,
+ FF::Scn::Cleanup,
FF::Scn::Debug,
)