Refactor targeting code into a utility function, add reverse images until we add code to do that programmatically.

This commit is contained in:
Anna Rose Wiggins 2023-10-05 16:53:23 -04:00
parent 0c3b0dbd64
commit d9d8ce17fd
10 changed files with 16 additions and 10 deletions

View file

@ -19,7 +19,7 @@ function Ika:init(target)
end
function Ika:onReady()
self.weaponTimer = playdate.timer.new(7000,
self.weaponTimer = playdate.timer.new(5000,
function()
local b = Bullet(10, 20, self:calculateVector(self.target))
b:moveTo(self.x - (self.width/2) - 1, self.y)
@ -30,7 +30,9 @@ function Ika:onReady()
end
function Ika:calculateVector(target)
return util.unitPointer(self:getPosition(), target:getPosition()) * 5
local x1,y1 = self:getPosition()
local x2,y2 = target:getPosition()
return util.unitPointer(x1,y1,x2,y2) * 5
end
function Ika:remove()