A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: help with particle effect

  1. #1
    Senior Member
    Join Date
    Jun 2004
    Location
    Montreal, Quebec
    Posts
    155

    help with particle effect

    hi there.

    I am trying to create a random particle effect that zooms from the distace to the foreground. I've seen and used methods like with "create fallign snow" but i'd like to change it to zoom instead of fall. (thinks starfield but with larger, scaling objects instead of stars)

    has anyone seem a tutorial or sample with this type of effect?

    thanks for any help or info!
    SS
    _______________________
    Stevie Spin
    Media Designer

  2. #2
    Warrior Monk
    Join Date
    Jul 2006
    Posts
    57

    here you go

    i just threw this together for you... really quick so it's nothing special but i think you will be able to get the idea from it.
    Attached Files Attached Files

  3. #3
    Senior Member
    Join Date
    Jun 2004
    Location
    Montreal, Quebec
    Posts
    155
    hey!

    thanks for taking the time to do this. it's really helpful!

    S
    _______________________
    Stevie Spin
    Media Designer

  4. #4
    Senior Member
    Join Date
    Jun 2004
    Location
    Montreal, Quebec
    Posts
    155
    Can I complicate this a bit more?

    I'd love to know how i could make random particles head towards a specific location using actionscript. I can loosely imagine how this might be done by calculating distance and moving closer step by step, but my acripting skillz aren't up to following it through.

    Could you help me there?

    thanks!
    Steve
    _______________________
    Stevie Spin
    Media Designer

  5. #5
    Warrior Monk
    Join Date
    Jul 2006
    Posts
    57
    sorry for the long wait, i came to work and forgot about the forums. here is the code to move the object to a target coordinate

    speed =20;

    target_x= //some number
    target_y= //some number

    tanx= target_x-this._x;
    tany= target_y-this._y;
    radangle = Math.atan2(tany,tanx);
    this._rotation = radangle*180/Math.PI; // this is to point it in the right direction if you need to
    deltay = speed * Math.sin(radangle);
    deltax = speed * Math.cos(radangle);

    function bombTarget(){
    if(deltax<0){
    if(target_x < this._x){
    this._x += deltax;
    this._y += deltay;
    }
    if(this._x <= target_x ){
    bombing = false;
    gotoAndPlay(2);
    }

    }
    if(deltax>0){
    if(target_x > this._x){
    this._x += deltax;
    this._y += deltay;
    }
    if(this._x >= target_x){
    bombing = false;
    gotoAndPlay(2);
    }

    }
    }

    i have the function as bombtarget but you can change it to whatever you want.

    onClipEvent(enterFrame){
    if(bombing){
    bombTarget();
    }
    }

    i hope that helps

  6. #6
    Senior Member
    Join Date
    Jun 2004
    Location
    Montreal, Quebec
    Posts
    155
    wow thanks so much for this.

    I'm having trouble actually implementing the code though. flash is detecting errors.

    Are you available to help me out a bit more?

    thanks!
    S
    _______________________
    Stevie Spin
    Media Designer

  7. #7
    Warrior Monk
    Join Date
    Jul 2006
    Posts
    57
    make sure you fill in your target numbers... and what errors are you getting?

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