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)
|
||||
end
|
||||
|
||||
function World2D:registerBody(body)
|
||||
return self.bodies:add(body, body.x, body.y, body.w, body.h)
|
||||
function World2D:moveActor(actor, x, y, filter)
|
||||
return self.bodies:move(actor.mainHitbox, x, y, filter)
|
||||
end
|
||||
|
||||
function World2D:getActorsInRect(x, y, w, h)
|
||||
|
@ -64,8 +64,12 @@ function World2D:getActorsInRect(x, y, w, h)
|
|||
return returnquery
|
||||
end
|
||||
|
||||
-- ACTORS FUNCTIONS
|
||||
-- Wrappers around Bump2D functions
|
||||
-- BODIES MANAGEMENT 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)
|
||||
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)
|
||||
end
|
||||
|
||||
function World2D:moveActor(actor, x, y, filter)
|
||||
return self.bodies:move(actor, x, y, filter)
|
||||
end
|
||||
|
||||
function World2D:checkCollision(actor, x, y, filter)
|
||||
return self.bodies:check(actor, x, y, filter)
|
||||
function World2D:checkCollision(body, x, y, filter)
|
||||
return self.bodies:check(body, x, y, filter)
|
||||
end
|
||||
|
||||
function World2D:getBodiesInRect(x, y, w, h)
|
||||
|
|
Loading…
Reference in a new issue