Moving/scrolling multiple objects

Just a real quick question, if I have a bunch of objects on that screen that are going to be moving/scrolling, is it more efficient (runtime wise, not lines of code) to have them all in a group and move the group or to just iterate through a table of objects and move each individually.

Just wondering if I would gain anything by moving everything into a group and changing the group’s x,y as needed or will it essentially perform the same. [import]uid: 47373 topic_id: 9742 reply_id: 309742[/import]

hey mrzorn,

it depends on what you want to do, but it seems like you’re trying to achieve a camera movement or some sort.

If you are, then it is better to put everything into a group and just move the group. That way you don’t have to worry about having too many unnecessary line of code and having to keep track of them. [import]uid: 12455 topic_id: 9742 reply_id: 35525[/import]

Yes. But no. Unless I’m missing something, this screws up the physics engine as it expects everything to be in the same coordinates system. As long as you don’t move a whole group, even if objects are in different groups, the physics engine works as it should. Not anymore as soon as you move a group.

I’m still trying to figure a way out of this mess. [import]uid: 51516 topic_id: 9742 reply_id: 35596[/import]

I noticed this last night when I was doing some testing with using groups.

Looks like I will be moving everything individually… or have to do something like put ever physics object into the same group, move the whole group but individually move back anything I didn’t want to move… [import]uid: 47373 topic_id: 9742 reply_id: 35611[/import]

I always move all the groups (or the parent group) where physics objects are and it works fine. [import]uid: 53514 topic_id: 9742 reply_id: 36063[/import]