View Full Version : Songs that Sing to You When You Hear Them

12-23-2003, 05:40 PM
OKAY, fellers, this is it. Once I figure this out, I will know EVERYTHING there is to know in the whole universe, which is strange, cause this is pretty low level stuff.

I have this scene with a bunch of crudely line-drawn people at an office party. I have applied a drag function, so that each person can be dragged and dropped. The instructions are "Help! It's been a long weekend, and we've forgotten how to mingle. Could you show us how it's done?"

The user then drags and drops the party people. If he puts them in the right order, they sing to him. Basically, I need to assign each of six people a window of coordinates they can fall between, and when they are all in their proper windows, a song starts. How in the blank can this be done?



12-23-2003, 05:50 PM
Oh, wait. Here's another idea. Instead of a set window, the images just have to be in a certain order. Can you do this based on z-index value?

Roy Sinclair
12-23-2003, 10:03 PM
z-index defines which element is on "top". All you need to do is make a check everytime anyone is moved to see if they're in the right order.

You only need to have an array of the "x" positions, with the leftmost (your perspective) person first in the array and the rest of the people in the array in the appropriate order. Then when any one of the people are moved you check the array to see that the "x" values ascend, once they do start the song.