Hey,
I just thought I'd share this little tidbit. I don't know whether you use an Object Orientated approach to your Corona Development, but if you do, neatly fitting display objects into any hierarchy you use can be a pain, particularly if you try to follow the model set out in Programming in Lua.
I figured I'd sit down and figure out an approach which would allow me to create a custom display group in much the same way I'd create any other object in Lua. A bit of headscratching later, and this is want I came up with
So here's an example of how I've managed to create a custom display group:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | CustomClass={} function CustomClass:new() o=display.newGroup() local metatable=getmetatable(o) local index=metatable.__index metatable.__index= function (table,key) if CustomClass[key] then return CustomClass[key] end return index(table,key) end return o end function CustomClass:newFunction() end |