From: Clifton James Palmer Date: Sat, 8 Dec 2018 18:54:00 +0000 (-0600) Subject: Fixed offset player path X-Git-Url: http://git.purplebirdman.com/lightcycles-love.git/commitdiff_plain/7fcd5691d699c8532a563c6b07574ebb09ebdf7f Fixed offset player path --- diff --git a/player.lua b/player.lua index ed4f210..0a37a0b 100644 --- a/player.lua +++ b/player.lua @@ -44,7 +44,13 @@ end function Player:draw() love.graphics.setColor(self.color) - love.graphics.rectangle('fill', self.position.x, self.position.y, self.width, self.height) + love.graphics.rectangle( + 'fill', + self.position.x-self.width/2, + self.position.y-self.height/2, + self.width, + self.height + ) -- add current position self:recordPosition() @@ -54,8 +60,8 @@ function Player:draw() end function Player:recordPosition() - table.insert(self.path, self.position.x + self.width/2) - table.insert(self.path, self.position.y + self.height/2) + table.insert(self.path, self.position.x) + table.insert(self.path, self.position.y) end function Player:multiple_keys_are_pressed()