summaryrefslogtreecommitdiffhomepage
path: root/app/systems/cleanup_bullets.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/systems/cleanup_bullets.rb')
-rw-r--r--app/systems/cleanup_bullets.rb11
1 files changed, 11 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
+)