No Object Oriented ! Aaaaaahhhhhhhhh !

Hi so I just switched from unity3d to corona sdk :)  and i am having trouble organizing display objects. (cuz UniTy be hell-a costly) :angry:

for example: I have created 100 display objects, Display object number 74 is Steve and Display Object number 4 is Kate; :huh:

how do i say Steve.strength=100;

how do i tell Steve to transition to Kate.position;

should I put them is a table? should I create a class? :blink:

I am super stumped I’v already created art assets but i cant figure out this display object stuff.

Thanks in Advance

Yep, put the in a table, and I would say, yes, create a class. That would allow you to say - although this is a poor example:

local myObjects = {} -- create an empty table myObjects[4] = class.newObject("Steve", 0, 100) -- where the parameters are name, x and y position myObjects[74] = class.newObject("Kate", 200, 400)   myObjects[4].strength = 100 transition.to(myObjects[4].image, {time = 500, x = myObjects[74].x, y = myObjects[74].y})

That’s a start - of course you’ll need to create a class for this to work! Do you want to be able to call your objects by their name (Steve, Kate, …) or is a number okay for you?

Well now, there go the code tags… If someone from Corona is reading this: seriously, fix this new forum. Pretty soon I won’t bother posting at all, due to how irritating all the bugs and usability problems are.

You have to use [] instead of < > now.

Still not being able to tab indent is really annoying when trying to post code, and it seems to ignore the indentations made using the buttons on the toolbar too.

Thanks Nick, that helped - weirdly a couple of days ago the old tags still worked.

Yep, put the in a table, and I would say, yes, create a class. That would allow you to say - although this is a poor example:

local myObjects = {} -- create an empty table myObjects[4] = class.newObject("Steve", 0, 100) -- where the parameters are name, x and y position myObjects[74] = class.newObject("Kate", 200, 400) &nbsp; myObjects[4].strength = 100 transition.to(myObjects[4].image, {time = 500, x = myObjects[74].x, y = myObjects[74].y})

That’s a start - of course you’ll need to create a class for this to work! Do you want to be able to call your objects by their name (Steve, Kate, …) or is a number okay for you?

Well now, there go the code tags… If someone from Corona is reading this: seriously, fix this new forum. Pretty soon I won’t bother posting at all, due to how irritating all the bugs and usability problems are.

You have to use [] instead of < > now.

Still not being able to tab indent is really annoying when trying to post code, and it seems to ignore the indentations made using the buttons on the toolbar too.

Thanks Nick, that helped - weirdly a couple of days ago the old tags still worked.