From ca6b363b70117198266022316a4ebfc9c8d1cda8 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 19 Jul 2017 15:14:32 +0200 Subject: Cleaned-up Contact functions --- not/World.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/not/World.lua b/not/World.lua index 992eef8..86b1560 100644 --- a/not/World.lua +++ b/not/World.lua @@ -327,12 +327,13 @@ function World:draw () end -- Box2D callbacks --- beginContact +-- TODO: Rather than here, these contacts should be in `Hero` (most likely). +-- TODO: Explode these into more functions.\ +-- TODO: Stop using magical numbers: +-- [1] -> Platform +-- [2] -> Hero +-- [3] -> Punch sensor function World.beginContact (a, b, coll) - -- TODO: Stop using magical numbers: - -- [1] -> Platform - -- [2] -> Hero - -- [3] -> Punch sensor if a:getCategory() == 1 then local x,y = coll:getNormal() if y < -0.6 then @@ -363,10 +364,8 @@ function World.beginContact (a, b, coll) end end end --- endContact function World.endContact (a, b, coll) if a:getCategory() == 1 then - -- Move them to Hero b:getUserData().inAir = true end end -- cgit v1.1