Sprites 2 newbie questions

Hello,

sorry for the following newbie questions.

For my first shooter game I was creating meteors through sprite objects (meteors) that I put in a group (meteor).

  1. is better to animate the parent first and put the children in the group, or animate children one by one after the insertion?

    –in create function parent meteor meteor:play() meteors.insert(meteors, meteor)

or

--in create function parent meteor meteors.insert(meteors, meteor) -- in main loop function if(meteors.numChildren ~= 0) then    for i = 1, meteors.numChildren do        if(meteors[i] ~= nil) then meteors[i]:play()            meteors[i].y = meteors[i].y + (stage \* 3) -- falling velocity               if(meteors[i].y \> \_H+meteors[i].height) then                  meteors[i]:pause() -- needs or not???                  display.remove(meteors[i])                  meteors[i] = nil               end         end    end end  
  1. Before removing sprites is good to pause the animation or is it useless?

Thanks for your help.

Greetings.

-j

I don’t believe the first option will work, as the :play() class is reserved for sprite objects, not the group they are placed within. Referring to the Animation tutorial Brent posted a bit over a year ago, there isn’t a reference to being able to animate a sprite’s display group.

That being said, I believe the second option is the best method. Also, you don’t need to stop the animation prior to removing the sprite. It will not cause issues in code.

http://www.coronalabs.com/blog/2012/10/02/animated-sprites-and-methods/

I don’t believe the first option will work, as the :play() class is reserved for sprite objects, not the group they are placed within. Referring to the Animation tutorial Brent posted a bit over a year ago, there isn’t a reference to being able to animate a sprite’s display group.

That being said, I believe the second option is the best method. Also, you don’t need to stop the animation prior to removing the sprite. It will not cause issues in code.

http://www.coronalabs.com/blog/2012/10/02/animated-sprites-and-methods/