Is this possible?

Im making a game where the level transition is based on a star landing and coming to a rest on a goal(platform), the problem is that I need the alert for the next level to only come up when not only is the star on the goal, but when all the other display objects have been removed. I have about 8 other objects… so my question is how do I detect their removal and incorporate it into my collision function? I hope this makes sense.

  
 local goal = display.newImage("images2/goal3.png")  
 goal.x = 211  
 goal.y = 269  
 goal.myName = "goal"  
 physics.addBody(goal, { friction = .4, bounce = .2, density = 0, shape = goalShape} )  
  
  
 local star = display.newImage("images2/star.png")  
 star.x = 206  
 star.y = 87  
 star.myName = "star"  
 physics.addBody(star, { friction = .3, bounce = .3, shape = starShape} )  
  
 local function onCollision (self, event)  
 if self.myName == "goal" and event.other.myName=="star" then  
 local alert = native.showAlert( "\*\*\*\*\*", "Level Complete!",   
 { "Next Level", "Replay" }, onComplete2 )  
  
 end  
 end  
  
 goal.collision = onCollision  
 goal:addEventListener("collision", goal)  

[import]uid: 10355 topic_id: 8122 reply_id: 308122[/import]

Make a table with all the stars in it so you can loop through the table to check them. When you remove an object you should nil the reference, so just check for nil when looping through the table. [import]uid: 12108 topic_id: 8122 reply_id: 28932[/import]