Bubbles.

  • MichalMystic
  • Newbie
  • Newbie
  • MichalMystic
  • Posts: 14

Post 3+ Months Ago

Hey all Im wondering if anyone knows a good way to make bubbles in flash so they look like there floating up and are random in a certian space of my flash project.
Actually they dont have to be random just look like there floating up. Im sure there a way to do this with action script so I dont have to animate each bubble.

Any help would be great!

Thx all!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

Like this
I made one 10X10 pixel bubble attachMovie'd 10 of them & animated them with this,
Code: [ Select ]
MovieClip.prototype.air = function(){
  this.onEnterFrame = function(){
   this._y> -10 ? this._y-=4 : (this._y=85,this._x=random(300));
   if(this.L>0){
     this._x++;this.C++;this._xscale+=10;this._yscale-=10;
     if(this.C>3){
      this.L=0;this.C=0;
     }
   }else{
     this._x--;this.C++;this._xscale-=10;this._yscale+=10;
     if(this.C>3){
      this.L=1;this.C=0;
     }
   }
  }
}

/*------initialize bubbles---------*/

for(i=0;++i<11;){
   _root["bb"+i].C = 0;
   _root["bb"+i].L = Math.round(Math.random());
   _root["bb"+i].air();
  }
  1. MovieClip.prototype.air = function(){
  2.   this.onEnterFrame = function(){
  3.    this._y> -10 ? this._y-=4 : (this._y=85,this._x=random(300));
  4.    if(this.L>0){
  5.      this._x++;this.C++;this._xscale+=10;this._yscale-=10;
  6.      if(this.C>3){
  7.       this.L=0;this.C=0;
  8.      }
  9.    }else{
  10.      this._x--;this.C++;this._xscale-=10;this._yscale+=10;
  11.      if(this.C>3){
  12.       this.L=1;this.C=0;
  13.      }
  14.    }
  15.   }
  16. }
  17. /*------initialize bubbles---------*/
  18. for(i=0;++i<11;){
  19.    _root["bb"+i].C = 0;
  20.    _root["bb"+i].L = Math.round(Math.random());
  21.    _root["bb"+i].air();
  22.   }

You would have to tweek the numbers but the basic formula is there.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 13 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.