mirror of
https://github.com/tanema/light_world.lua.git
synced 2024-12-24 20:24:19 +00:00
commit
2d1d65df4f
11
lib/body.lua
11
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
|
||||
|
Loading…
Reference in New Issue
Block a user