Hello. I was wondering how would I make it so when somebody is playing a level on my game, when they collide the cannon ball into the pirate ship, that it puts a star onto the level image on the level select scene. Now, I am using the director class so for the level select screen, I made a bunch of different images and positioned them onto the level select screen, added functions and listeners, but because im using director, it allows me to put them into a local group, so when i transition scenes, it clears up memory. I know how to add the collide function and everything so the win screen pops up, I just don’t know how I would make it so it would a star image ontop of it. [import]uid: 122076 topic_id: 22399 reply_id: 322399[/import]
It’s really simple, but it’s hard to explain.
You basically need a table that holds a flag for each level. Start out with the flags all equaling false, then as the player’s earn the star, set the flag to true, then when you draw your level select screen, you would do something like:
for i = 1, #levels do
-- code to draw your level bits
if \_G.gotStar[i] == true then
-- code to draw the star
end
end
Since you’re using director, its easier to use a global table to hold the values, ergo _G.gotStar [import]uid: 19626 topic_id: 22399 reply_id: 89296[/import]