need suggestion with app

Hello all,

I need some suggestions/advice on how to proceed. At the moment I have everything working but cant figure out on how I should approach the final step. I would like to display text on screen and play a sound, but only based on 3 images’ x/y coordinates and after the other sounds have played.
I have included a trimmed version of the code so far, keep in mind that I have 2 other test targets.

Also, I have added obj2.isMovable = false, but I can still move the object. What else do I need to do?

Thanks!

[code] --Test Target3 > Boy3
–For some reason the check has to be done in reverse for this boy, i don’t get it
elseif obj1.myName == “target” and obj2.myName == “boy3” then
transition.to(obj2, {x=400, y=250})
audio.play(lastsound)
obj2.isMovable = false --Set the boy to unmoveable

elseif obj1.myName == “target2” and obj2.myName == “boy3” then
transition.to(obj2, {x=400, y=50})

elseif obj1.myName == “boy3” and obj2.myName == “target3” then
transition.to(obj1, {x=400, y=50})

–final
local youdiditText = display.newText(“You did it!”, 0, 0, “HelveticaNeue”, 42)
youdiditText:setTextColor(255, 255, 255)
youdiditText.x = display.contentCenterX
youdiditText.y = displaycontentCenterY
transition.to(youdiditText, {x=240, y=150})
localGroup:insert(youdiditText) [import]uid: 32253 topic_id: 8519 reply_id: 308519[/import]

When you say you want to display an image based on three objects coords, I assume you mean if they are in certain positions then the text displays. (As in, how they are positioned is how you win the level.)

If that’s the case then you’d want to do something like

[lua]if obj1.x == 10 and obj1.y == 10 and obj2.x == 20 and obj2.y == 20 then
– your text box here
end[/lua]

(Of course the above are just random coords.)

That said, you likely wont want to use exact values as I have above and rather use < and >. (Because if the objects are drag-able then it’s unlikely the user will position then on the EXACT right coordinate.)

Is that the sort of thing you’re talking about?

I may have misunderstood as I could read your question two different ways.

Peach [import]uid: 10144 topic_id: 8519 reply_id: 30976[/import]