Need help with level ending mechanism?

Hey everyone,

So basically, what I want to do is when the score of my game reaches 100, i want to display an object then. Then if my player collides with the object, a screen appears saying “congrats you passed the level, would you like to move on to the next one?”. Could someone help me with this? BTW, I defined the ‘score’ like this “local score = 0”. [import]uid: 175550 topic_id: 31078 reply_id: 331078[/import]

It would help to show code, but what you’d likely do is in the function where you points to the player do a check, so;
if score == 100 then
(If you give more than one at a time check for greater than or equal to, not just equal to as have done above)

Then in that if statement would spawn the object and add collision listener to it, or already have it on the player - then in the collision function do your popup. [import]uid: 52491 topic_id: 31078 reply_id: 124266[/import]

Heres how i created the scoring, does this help?

[code]
local score = 0
local scoreText = display.newText("Score: " … score, 0, 0, “Times”, 50)
scoreText:setReferencePoint(display.CenterLeftReferencePoint)
scoreText.x = 0
scoreText.y = 30
[import]uid: 175550 topic_id: 31078 reply_id: 124268[/import]

Just removed a dupe post from you, please review our rules and guidelines: http://developer.coronalabs.com/forum/2011/05/05/forum-rules-and-guidelines

Would need to see more code. Have you attempted what I discussed above? That’s a very clear outline of process if you take it a step at a time, IMHO. [import]uid: 52491 topic_id: 31078 reply_id: 124283[/import]

You need to learn storyboard to change scenes (level1 to level2) [import]uid: 116842 topic_id: 31078 reply_id: 124341[/import]

It would help to show code, but what you’d likely do is in the function where you points to the player do a check, so;
if score == 100 then
(If you give more than one at a time check for greater than or equal to, not just equal to as have done above)

Then in that if statement would spawn the object and add collision listener to it, or already have it on the player - then in the collision function do your popup. [import]uid: 52491 topic_id: 31078 reply_id: 124266[/import]

Heres how i created the scoring, does this help?

[code]
local score = 0
local scoreText = display.newText("Score: " … score, 0, 0, “Times”, 50)
scoreText:setReferencePoint(display.CenterLeftReferencePoint)
scoreText.x = 0
scoreText.y = 30
[import]uid: 175550 topic_id: 31078 reply_id: 124268[/import]

Just removed a dupe post from you, please review our rules and guidelines: http://developer.coronalabs.com/forum/2011/05/05/forum-rules-and-guidelines

Would need to see more code. Have you attempted what I discussed above? That’s a very clear outline of process if you take it a step at a time, IMHO. [import]uid: 52491 topic_id: 31078 reply_id: 124283[/import]

You need to learn storyboard to change scenes (level1 to level2) [import]uid: 116842 topic_id: 31078 reply_id: 124341[/import]