modules/world: add a way to check collisions
This commit is contained in:
parent
977a735608
commit
b80566b4ec
2 changed files with 10 additions and 0 deletions
|
@ -102,6 +102,12 @@ function BaseWorld:moveActor(actor, x, y, filter)
|
|||
return x, y, {}, 0
|
||||
end
|
||||
|
||||
function BaseWorld:checkCollision(actor, x, y, filter)
|
||||
-- as the baseworld have no collision function, we return empty collision
|
||||
-- datas, but from the same type than bump2D will return
|
||||
return x, y, {}, 0
|
||||
end
|
||||
|
||||
function BaseWorld:queryRect(x, y, w, h)
|
||||
local query = {}
|
||||
local x2, y2 = x + w, y + h
|
||||
|
|
|
@ -53,6 +53,10 @@ function World2D:moveActor(actor, x, y, filter)
|
|||
return self.actors:move(actor, x, y, filter)
|
||||
end
|
||||
|
||||
function World2D:checkCollision(actor, x, y, filter)
|
||||
return self.actors:check(actor, x, y, filter)
|
||||
end
|
||||
|
||||
function World2D:queryRect(x, y, w, h)
|
||||
return self.actors:queryRect(x, y, w, h)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue