chore(world): improve separation between bodies and actors in code
This commit is contained in:
parent
7cce6ea99f
commit
c57f372648
1 changed files with 10 additions and 10 deletions
|
@ -47,8 +47,8 @@ function World2D:registerActor(actor)
|
||||||
World2D.super.registerActor(self, actor)
|
World2D.super.registerActor(self, actor)
|
||||||
end
|
end
|
||||||
|
|
||||||
function World2D:registerBody(body)
|
function World2D:moveActor(actor, x, y, filter)
|
||||||
return self.bodies:add(body, body.x, body.y, body.w, body.h)
|
return self.bodies:move(actor.mainHitbox, x, y, filter)
|
||||||
end
|
end
|
||||||
|
|
||||||
function World2D:getActorsInRect(x, y, w, h)
|
function World2D:getActorsInRect(x, y, w, h)
|
||||||
|
@ -64,8 +64,12 @@ function World2D:getActorsInRect(x, y, w, h)
|
||||||
return returnquery
|
return returnquery
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ACTORS FUNCTIONS
|
-- BODIES MANAGEMENT FUNCTIONS
|
||||||
-- Wrappers around Bump2D functions
|
-- Basic function to handle bodies. Wrappers around Bump2D functions
|
||||||
|
|
||||||
|
function World2D:registerBody(body)
|
||||||
|
return self.bodies:add(body, body.x, body.y, body.w, body.h)
|
||||||
|
end
|
||||||
|
|
||||||
function World2D:updateBody(body)
|
function World2D:updateBody(body)
|
||||||
return self.bodies:update(body, body.x, body.y, body.w, body.h)
|
return self.bodies:update(body, body.x, body.y, body.w, body.h)
|
||||||
|
@ -75,12 +79,8 @@ function World2D:removeBody(body)
|
||||||
return self.bodies:remove(body)
|
return self.bodies:remove(body)
|
||||||
end
|
end
|
||||||
|
|
||||||
function World2D:moveActor(actor, x, y, filter)
|
function World2D:checkCollision(body, x, y, filter)
|
||||||
return self.bodies:move(actor, x, y, filter)
|
return self.bodies:check(body, x, y, filter)
|
||||||
end
|
|
||||||
|
|
||||||
function World2D:checkCollision(actor, x, y, filter)
|
|
||||||
return self.bodies:check(actor, x, y, filter)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function World2D:getBodiesInRect(x, y, w, h)
|
function World2D:getBodiesInRect(x, y, w, h)
|
||||||
|
|
Loading…
Reference in a new issue