this seems to work but could someone tell me if I am taking the right approach please? I come from an AS3 background so this is a bit like how I would do it, but I’m not sure of the specific Lua implementation for classes. Please note this is a simplified version and would need to be more adaptable for different graphics type’s etc… and I may decide to add the physics body definition to the class as well
My “Class” Object (BallActor.lua)
[lua]BallActor = {} – Create a table to hold the class methods
I don’t really know how metatables interact with the display object “tables” that Corona has, but I’m wondering if you even need a separate “sprite” entry in “object” or if you can simply make “object” a display object. That’s similar to how I do things except I don’t use metatables, taking advantage of the fact that all objects are really tables: http://developer.anscamobile.com/content/display-objects#Display_Objects_vs._Tables:_A_Technical_Discussion
EDIT: Actually the second line of that link specifically states “you cannot set the metatables of display objects.” doh
EDIT2: Just noticed your newer thread, posting there too. [import]uid: 12108 topic_id: 3407 reply_id: 21541[/import]