Vertically moving objects stopping on "impact"?

Hey everyone. I’d like to create a movie where many different objects that start offscreen at top fall onto the stage and stop at a line (horizontal) and “stick” there. Then, when the line holding all the objects gets too “overburdened” I want it to sink down, say 100 pixels or so, and continue receiving more vertically moving objects until it sinks more. All the while I want the objects to pile up on top of each other, stacking up like a mountain of objects. Would the code go on each object or the timeline? Has anybody tried something like this where moving objects pile up? If you’d be so kind, please see the attached .gif as an illustration.

Thanks,
*<:D Scottie

Hi,

Use hitTest to get to know if an object hits (what else!) something
in an array.

OK,

declare an array where the only entry is the horizon line make the falling object(s) testHit any entries in the array (with a for loop) if true stop it(them) and push it into the array. if the array length is bigger than the number of objects the horizon can support make every object’s (including the horizon) _y sink 100 pixels.

SHO

Hope this is usefull for you.

Hi eki, thanks for responding. I’m very new at Flash & AS so I don’t quite understand your answer. How do I set up an array, where do I actually attach the code, how do I set up the timeline, etc… Could you possibly throw some code at me and tell me how to use it and where?

Thanks!
*<:D Scottie

Hi,

I’m leaving work now(it’s 18:20 here), I’ll try to knock something out tonite at home and I’ll post it tomorrow if that’s all right with u.

cheers

SHO

Hi,

I’m posting a fla that does what u want.
I’ve done quickly so it’s a bit rough but it’s a starting point
for u to study and refine.

Cheers

SHO

SHO, thank you so much! So nice of you to whip up a .fla. It’s just like I described. How would I alter the code to allow many objects to “fall” into the screen at the same time in a random manner, and also how would I speed up the motion? I want it to look very fast with many objects flying in.

So many Flash geniuses out there like yourself. I’m a Print Graphic Designer just learning all this stuff.

Cheers,
*<:D Scottie

Hi,

I’m posting a new fla where u can chenge the speed by changing a variable (commented) called… yes you guessed it…speed.
You can also change the number of pixels that the stack falls.

Regarding many objects falling at the same time, it needs a bit of rethinking but I’ll find some time to do it (I like the idea too).

I’ll post any updates.

Cheers

How do you know where to begin!? The code is much more complex than I thought it would be. Some questions if you don’t mind:

numberOfObjects = 16;
//Do you have to declare the number of objects? I would like to start with hundreds, or perhaps an indefinite unknown amount.

count = 6;
// What exactly is the count… of what?

objectsToFall = new Array();
//Is this “Total” or “Number of objects to fall at the same time”?

weight = [horizon];
//I understand this one! But I only want the horizon to fall when a certain number of objects gets stacked up (say 80), and then the horizon should fall.

numberToFall = 1;
//Perhaps this can be changed to something called “random”? I’d like a random number of objects to fall at random intervals (2 randoms)

speed = 10;
// I tried changing only the speed value but it made everything in the movie change, including where the objects fell, how long, etc… SO confusing!

You are very kind to pursue this project with me. Hugs to London!

*<:D Scottie