Stars Displayed for Levels

I want to display 1, 2 or 3 stars for each level completed by the player (same as on most games).  However, I’m having trouble figuring out a streamlined approach.  Everything I try is nothing more than ALOT of repetition of code.  I would really appreciate any guidance.

Thanks,

Lori

see Rob’s tutorial here: http://coronalabs.com/blog/2014/08/12/tutorial-building-a-level-selection-scene/

the key is to set up your data in an array that can be looped over - that should eliminate the code replication.

another convenience thing i like to do is set up a sprite sequence with: locked,0,1,2,3stars

with an instance of that sprite in each level group, it’s easy to set its frame to indicate the state of that level

(Rob’s tutorial draws stuff manually, but I think that’s only so it’s more stand-alone code, not dependent on images - the concepts are still the same tho)

Thank you - I’ll review the tutorial.

see Rob’s tutorial here: http://coronalabs.com/blog/2014/08/12/tutorial-building-a-level-selection-scene/

the key is to set up your data in an array that can be looped over - that should eliminate the code replication.

another convenience thing i like to do is set up a sprite sequence with: locked,0,1,2,3stars

with an instance of that sprite in each level group, it’s easy to set its frame to indicate the state of that level

(Rob’s tutorial draws stuff manually, but I think that’s only so it’s more stand-alone code, not dependent on images - the concepts are still the same tho)

Thank you - I’ll review the tutorial.