dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Help with Random animation

  1. #1
    Member
    Join Date
    Dec 2002
    Location
    Argentina
    Posts
    42

    Help with Random animation

    I need to add a random animation and when finish one it should start another one and so on, I tryed to find some example like this but didn't found any
    Can someone please help me to know how to do it?

  2. #2
    Senior Member FPChris's Avatar
    Join Date
    May 2003
    Location
    NJ
    Posts
    644
    Say you have 5 different animations to begin with.
    They are all in a line on the mainimeline, for example.
    The start of each animation has a label...
    Anim1,Anim2,Anim3 etc.

    The last frame of each animation has this script.

    var Jump = random(5); //0-4
    if(Jump == 0){ gotoAndPlay("Anim1"); }
    if(Jump == 1){ gotoAndPlay("Anim2"); }
    if(Jump == 2){ gotoAndPlay("Anim3"); }
    if(Jump == 3){ gotoAndPlay("Anim4"); }
    if(Jump == 4){ gotoAndPlay("Anim5"); }

    you could also put this script in frame 1
    to randomize the starting animation.

    Chris
    http://www.**********-dms.com

  3. #3
    Member
    Join Date
    Dec 2002
    Location
    Argentina
    Posts
    42
    Thanks for your fast answer!
    I should be with a random starting animation but I cann't do it run can you please upload a fla file so I can see how it should be?
    Thanks a lot!!!

  4. #4
    Senior Member FPChris's Avatar
    Join Date
    May 2003
    Location
    NJ
    Posts
    644
    here ya go. 3 stupid little anims in this example but the
    theory is the same.

    Chris
    Attached Files Attached Files
    http://www.**********-dms.com

  5. #5
    Member
    Join Date
    Dec 2002
    Location
    Argentina
    Posts
    42
    THANKS!!!

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