diff --git a/gamecore/modules/world/baseworld.lua b/gamecore/modules/world/baseworld.lua index 375b2dc..02007ad 100644 --- a/gamecore/modules/world/baseworld.lua +++ b/gamecore/modules/world/baseworld.lua @@ -121,32 +121,6 @@ function BaseWorld:removeActor(actor) end end -function BaseWorld:moveActor(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: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 - for i,v in ipairs(self.actors) do - if (v.x >= x) and (v.x + v.w >= x1) and - (v.y >= y) and (v.y + v.h >= y1) then - - table.insert(query, v) - end - end - - return v -end - function BaseWorld:countActors() return #self.actors end @@ -174,6 +148,48 @@ function BaseWorld:getVisibleActors(id) return returnquery end +-- BODIES MANAGEMENT FUNCTIONS +-- Basic function to handle bodies. Empty function here as baseworld doesn't +-- handle bodies + +function BaseWorld:registerBody(body) + return nil +end + +function BaseWorld:updateBody(body) + return x, y, {}, 0 +end + +function BaseWorld:removeBody(body) + return nil +end + +function BaseWorld:moveActor(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: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 + for i,v in ipairs(self.actors) do + if (v.x >= x) and (v.x + v.w >= x1) and + (v.y >= y) and (v.y + v.h >= y1) then + + table.insert(query, v) + end + end + + return v +end + -- INFO FUNCTIONS -- Give infos about the world