I’ve been trying to flip the snow tutorial code over so that they become bubbles. For some reason when I adjust the conditional statement that resets the snow/bubbles when it reaches a point, everything stops working.
Can someone help?
onClipEvent (load) {
//specifies the size of the movie stage
movieWidth = 580;
movieHeight = 50;
//variables that will modify the falling snow
i = 1+Math.random()*2;
k = -Math.PI+Math.random()*Math.PI;
//giving each snowflake unique characteristics
this._xscale = this._yscale=10+Math.random()*100;
this._alpha = 25+Math.random()*100;
this._x = -10+Math.random()*movieWidth;
this._y = -10+Math.random()*movieHeight;
}
onClipEvent (enterFrame) {
//putting it all together
rad += (k/5000)*Math.PI;
this._x += Math.cos(k);
this._y -= i;
if (this._y<=0){
this._y = 200;
}
if ((this._x>=movieWidth) || (this._x<=0)) {
this._x = Math.random()*movieWidth;
this._y = 100;
}
}