From 91996c4fc5ee76ce8c08e23baa17c6a398de6276 Mon Sep 17 00:00:00 2001 From: Guard13007 Date: Tue, 28 Oct 2014 11:40:51 -0700 Subject: [PATCH] added move function to bodies --- lib/body.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/body.lua b/lib/body.lua index fea2a87..d3b12bb 100644 --- a/lib/body.lua +++ b/lib/body.lua @@ -109,6 +109,17 @@ function body:setPosition(x, y) end end +-- move position +function body:move(x, y) + if x then + self.x = self.x + x + end + if y then + self.y = self.y + y + end + self:refresh() +end + -- get x position function body:getPosition() return self.x, self.y