A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Help, Random Leaf Blowing-- See Attachment

  1. #1
    Senior Member
    Join Date
    May 2003
    Posts
    160

    Help, Random Leaf Blowing-- See Attachment

    i am pulling my hair out trying to figure this out:

    i got my leaf to move on a sine wave and have the alpha fade out when it's x position reaches a certain point.

    i got the leaf to duplicate as well, but..

    what else i want to happen is this:

    -----

    when leaf _x position=(say 350)
    duplicate leaf
    randomize leaf starting x position
    randomize leaf starting y position
    randomize the sine wave length
    randomize the sine wave height
    randomize leaf speed
    end

    basically i want to get the effect of leaves blowing off a tree, while having each leaf be different than the other.

    i have attached my quick and dirty prototype, any help would be appriciated, this is driving me nutts
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    May 2003
    Posts
    160
    anyone?

  3. #3
    Flashkit Jedi

    Join Date
    Jul 2001
    Location
    Coruscant System
    Posts
    3,426
    You would need the following code to dow what you want:

    Code:
    onClipEvent(enterFrame){
      if(_x >= 350){
        duplicateMovieClip(this, "leaf2", 1);
        leaf2._x = Math.random() * Stage.width;
        leaf2._y = Math.random() * Stage.height;
        sinelength = Math.randon() * 10;
        sinewidth = Math.random() * 10;
        speed = Math.random() * 10;
      }
    }
    You see the *10 pieces of code, hange these to the number you want it to be max of. For example at the moment ith this code, these numbers are random numbers in between 1 and 10.

    XFM

  4. #4
    Senior Member
    Join Date
    May 2003
    Posts
    160
    that didn't seem to do the trick, i am reposting the file with your code added in. maybe i added it in there wrong?
    Attached Files Attached Files

  5. #5
    Senior Member
    Join Date
    May 2003
    Posts
    160
    humm.. this can't be that hard, anyone?

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