mirror of
https://github.com/vrld/HC.git
synced 2024-11-18 12:54:23 +00:00
Add moveTo
This commit is contained in:
parent
4a24422e54
commit
896f58110e
@ -57,6 +57,11 @@ end
|
||||
local Shape = Class{name = 'Shape', function(self, t)
|
||||
self._type = t
|
||||
end}
|
||||
function Shape:moveTo(x,y)
|
||||
local current = vector( self:center() )
|
||||
local to = vector.isvector(x) and x or vector(x,y)
|
||||
self:move( to-current )
|
||||
end
|
||||
|
||||
-- supported shapes
|
||||
Shape.POLYGON = setmetatable({}, {__tostring = function() return 'POLYGON' end})
|
||||
|
Loading…
Reference in New Issue
Block a user