From 5aa6b335be1463ecc2f154cf6a830498833efb2c Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Fri, 12 Aug 2011 13:00:54 +0200 Subject: [PATCH] Add HC.clear() --- init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/init.lua b/init.lua index e0259e0..191d7ff 100644 --- a/init.lua +++ b/init.lua @@ -53,6 +53,14 @@ function init(cell_size, callback_collide, callback_stop) is_initialized = true end +function clear() + hash = Spatialhash(hash.cell_size) + active_shapes, passive_shapes, ghosts = {}, {}, {} + current_shape_id = 0 + shape_ids = setmetatable({}, {__mode = "k"}) + groups = {} +end + function setCallbacks(collide, stop) if type(collide) == "table" and not (getmetatable(collide) or {}).__call then stop = collide.stop