From e78c6699a74fa4e00689a96707b304911b32eb08 Mon Sep 17 00:00:00 2001 From: arngo <27396817+arngo@users.noreply.github.com> Date: Sun, 19 Dec 2021 23:00:44 -0500 Subject: bullet cleanup --- app/systems/cleanup_bullets.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/systems/cleanup_bullets.rb (limited to 'app/systems/cleanup_bullets.rb') 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 +) -- cgit v1.2.3