diff --git a/birb/objects/2D/point.lua b/birb/objects/2D/point.lua index 893bf9c..eea90c6 100644 --- a/birb/objects/2D/point.lua +++ b/birb/objects/2D/point.lua @@ -31,7 +31,7 @@ function Point:setPosition(x, y) self.x, self.y = x, y end -function Point:move(x, y) +function Point:goToward(x, y) local x = x or 0 local y = y or 0 self:setPosition(self.x + x, self.y + y) @@ -63,7 +63,7 @@ function Point:getMiddlePoint(x, y) return utils.math.getMiddlePoint(self.x, self.y, x, y) end -function Point:getDirectionFromPoint(other) +function Point:getMiddlePointFromPoint(other) local x, y = other:getPosition() self:getMiddlePoint(x, y) end diff --git a/birb/objects/2D/rect.lua b/birb/objects/2D/rect.lua index 1218c7a..97fa54e 100644 --- a/birb/objects/2D/rect.lua +++ b/birb/objects/2D/rect.lua @@ -29,6 +29,11 @@ function Rect:new(x, y, w, h) self:setSize(w, h) end +function Rect:set(x, y, w, h) + self:setPosition(x, y) + self:setSize(w, h) +end + function Rect:setSize(w, h) self.w = w or self.w self.h = h or self.h @@ -39,6 +44,10 @@ function Rect:getArea() return x, y, self.w, self.h end +function Rect:getShape() + return self:getArea() +end + function Rect:getCorners() local x, y, w, h = self:getArea() return x, y, x + w, y + h