A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Bubbles - duplicate problems

Threaded View

  1. #1
    Member
    Join Date
    Jun 2004
    Posts
    83

    Bubbles - duplicate problems

    Hi!

    I'm working on a application with some bubbles. Each bubble goes from the bottom to the top. It works just fine with just one bubble, but when I duplicate the bubble it just stops on it's way towards the top. I want to have many of them, with different properties.

    Could there be a "level" problem or?

    Here's the code:

    Code:
    function createBubble(){
    	i++;
    	scale = random(120) + 30;
    	xMove = random(10)+1;
    	yMove = random(30)+1;
    	bubble = bubble_mc.duplicateMovieClip("bub" + i, i);
    	bubble._xscale = scale;
    	bubble._yscale = scale;
    }
    
    my_btn.onPress = function(){
         //myBubble = setInterval(createBubble, random(3000) + 100);
        createBubble();
    }
    
    this.onEnterFrame = function() {
    	
    		bubble._y -= yMove;		
    		bubble._x = Math.sin(a) * xMove + 150;
    		a += 0.2;
    
    		
    		if(bubble._xscale > 0){
    			bubble._xscale -= scaleFactor;
    			bubble._yscale -= scaleFactor;
    		}
    		
    		if(bubble._y < 0){
    			removeMovieClip(bubble);
    			createBubble();
    		}
    
    	
    }
    Thankful for some advice
    /S-fish
    Last edited by swordfish123; 02-08-2007 at 02:28 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center