From c46ee29caadc0eaae798e78678a1e4178ff2c15d Mon Sep 17 00:00:00 2001 From: annabunches Date: Sat, 30 Sep 2023 16:11:39 -0400 Subject: [PATCH] Add weapon to Ebi. --- src/enemy/ebi.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/enemy/ebi.lua b/src/enemy/ebi.lua index 5b4f04c..026c2c6 100644 --- a/src/enemy/ebi.lua +++ b/src/enemy/ebi.lua @@ -18,6 +18,8 @@ function Ebi:init() dir = -1 end self.vector = {x=0, y=dir} + + self:weaponTimer() end function Ebi:update() @@ -28,3 +30,14 @@ function Ebi:update() end end end + +function Ebi:weaponTimer() + local t = playdate.timer.new(1000, + function() + local b = Bullet(2, 1, {x=-1, y=0}, 0x2) + b:moveTo(self.x - (self.width/2) - 1, self.y) + b:add() + end + ) + t.repeats = true +end