Hello there everyone.
I created bubbles using the snow 3.0 tutorial from here at kirupa. I slightly altered the code so it would be for bubbles on a canvas of 800x500.
The problem with the tutorial is that it is for snow moving downward on the y axis. for bubbles in the water, I need them going upward. Could someone please help me with which part of the code I need to alter so the bubbles will move up and not down? Also, I need the life of the bubble to last the length of the canvas.
Thank you
Code:
init = function () {
width = 800;
// pixels
height = 500;
// pixels
max_bubblesize = 10;
// pixels
bubbles = 75;
// quantity
for (i=0; i<bubbles; i++) {
t = attachMovie("bubbles", "bubbles"+i, i);
t._alpha = 20+Math.random()*60;
t._x = -(width/2)+Math.random()*(1.5*width);
t._y = -(height/2)+Math.random()*(1.5*height);
t._xscale = t._yscale=50+Math.random()*(max_bubblesize*10);
t.k = 1+Math.random()*2;
t.wind = -1.5+Math.random()*(1.4*3);
t.onEnterFrame = mover;
}
};
mover = function() {
this._y += this.k;
this._x += this.wind;
if (this._y>height+10) {
this._y = -20;
}
if (this._x>width+20) {
this._x = -(width/2)+Math.random()*(1.5*width);
this._y = -20;
} else if (this._x<-20) {
this._x = -(width/2)+Math.random()*(1.5*width);
this._y = -20;
}
}
init();