I apologize for the newbie nature of this question, I am coming to LUA and Gideros from objective c and java and I expect that's causing me more grief then helping.
I am trying to adopt the basic box2d tutorial (
http://appcodingeasy.com/Gideros-Mobile/Gideros-Box2D-basics) from appcodingeasy to do the following
1. Have 2 balls falling
2. When the balls collide, weld them together and stop movement.
This tutorial was a great starting point but now that I am trying to expand it I have hit a problem
Looking at the code, it seems that the main.lua is an derived class from sprite.
scene = gideros.class(Sprite) |
What seems to be tripping me up is the onBeginContact event does not seem to be firing a class method
self.world:addEventListener(Event.BEGIN_CONTACT, onBeginContact) |
So when I attempt to do
local jd = b2.createWeldJointDef(bodyA, bodyB, bodyA:getPosition(), bodyB:getPosition())
weldJoint = world.createJoint(jd) |
I receive "attempt to index global 'world' (a nil value)" this is also true if I try to specify self.world.
So my question is how do I access the world object within onBeginContact if its a member variable of scene.
Thanks for your help.
Rich in NY.
Comments
so you can do:
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive