what if you just gave it a random x and y to end at… and then have it fall to that place… but a higher up y would mean its farther back and you can adjust the scale and alpha according to that…
its a start, i have this great idea tho for my site and i need to be able to have the rain in actual space, but i think it may work with what you gave; i’ll have to see…
Picture a building with fire alarm sprinklers installed on the ceiling.
You stand at the entrance to the room looking at the sprinkler heads.
They start coming on one at a time, completely at random.
The ceiling contains 20 heads in all.
Each one fires the exact same drop of water completely at random.
This is what I want.
I want to make a movieclip called “raindrop” and create a space much like the above described room. Then have my “raindrop movie clip” randomly play at each of the spots on the “ceiling” from the “sprinkler heads,” completely at random.
Now depending on how far to the front or back the “sprinkler head” was, depends on the scale of the drop or the alpha shading.
Scootman came up with the closest thing so far.
But if I could have this array, it would be awesome.
–
I hope that clears it up, let me know if you have any more questions.
I’m confused too…What scootman sent was exactly that…but without storing each rain drop in 3d space (ie.without using an array).
Why would you need to use an array???
anyway…have a look at this fla. Its not rain though, its fireworks. You can rotate the view around the ‘bursts’ by draging with the mouse. Is this what you want to do with your rain???
The 3D tutorial or the perspective tutorial might help you get started. And by the way, if the position of the drops is completely random, there’s no need for that array. Just initialize the starting vertical position (y) to a constant value
OK, I don’t have flash, so it might (will) be bugged, but hopefully it will give you ideas:
// global functions
speed=5;
fl=300;
// first drop
this.createEmptyMovieClip ("drop", -10);
drop.lineStyle (3, 0, 100);
drop.lineTo (.45, .15);
drop._visible = 0;
// function that creates a drop
function createDrop (x, y, z) {
depth ++;
var myDrop = drop.duplicateMovieClip ("drop"+depth, depth);
myDrop.x = x;
myDrop.y = y;
myDrop.z = z;
myDrop.scale = fl / (fl+myDrop.z);
myDrop.onEnterFrame = fall;
}
// function that makes the drop fall
function fall () {
this.y += speed;
this._x = this.x * this.scale;
this._y = this.y * this.scale;
this._alpha = 100 * this.scale;
}
// creation of the drops
setInterval (createDrop, 500, random(400), 10, random (200)+100);
// global variables
speed=5;
fl=300;
// first drop
this.createEmptyMovieClip ("drop", -10);
drop.lineStyle (3, 0, 100);
drop.lineTo (.45, .15);
drop._visible = 0;
// function that creates a drop
function createDrop () {
depth ++;
var myDrop = drop.duplicateMovieClip ("drop"+depth, depth);
myDrop.x = random(400);
myDrop.y = 10;
myDrop.z = 100+random(200);
myDrop.scale = fl / (fl+myDrop.z);
myDrop.onEnterFrame = fall;
}
// function that makes the drop fall
function fall () {
this.y += speed;
this._x = this.x * this.scale;
this._y = this.y * this.scale;
this._alpha = 100 * this.scale;
this._xscale = this._yscale = 100 * this.scale;
if (this.y > 200) {
delete this.onEnterFrame;
// this.removeMovieClip();
}
}
// creation of the drops
setInterval (createDrop, 50);
You’ll notice that I put a few things in the onEnterFrame that I could have put outside, but if you want to give an angle to your drops, you’ll probably have to do it like that