A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Math genius wanted!!

  1. #1
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472

    Post nobody seems tounderstands me:(

    In the example below the MC's x value increases. When the clip is at a given point it goes back and increases again and so on. When adding acceleration ("acc") the animation is faaling apart. My problem is figuring out the new startingpoint (startx, or the endpoint(max_x)) to make the animation look smoothe?

    onClipEvent (load) {
    max_x = 350
    this.startx = this. _x
    }
    onClipEvent (enterFrame) {
    acc = acc+0.05;
    this._x = this._x+5+acc;
    if (this._x>max_x) {
    this._x = this.startx;
    }
    }

    Dear reader, yeah YOU!!
    Let me know if I'm making myself understandable.


    [Edited by podenphant on 09-13-2000 at 05:12 AM]

  2. #2
    Junior Member
    Join Date
    Sep 2000
    Posts
    3

    acceleration

    I think you have too many accelerating components
    all you really need is:

    onClipEvent (enterFrame) {
    acc = 0.05;
    this._x = this._x + acc;
    if (this._x>max_x) {
    this._x = this.startx;
    }

    tweek the value of acc to get the right amount of acceleration.


  3. #3
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472
    Hi harry,
    Thanx for your reply.

    I don't see the acceleration in your example?!

    this._x = this._x + 0.05
    is not acceleration.
    Hit me baby one more time!

  4. #4
    Junior Member
    Join Date
    Sep 2000
    Posts
    3

    acceleration

    Sorry, it should be this:

    onClipEvent (enterFrame) {
    acc = acc + 0.05;
    this._x = this._x + acc;
    if (this._x>max_x) {
    this._x = this.startx;
    }

  5. #5
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472
    Tanks again Harry,
    That was my idea.

    If you imagine a movie clip looking like this with increasing x-value.

    \_____\_____\_____\_____\_____\_____

    The problem is that (because of the acceleration), max_x is different for each run through, and therefore the animation isn't smoothe.

    [Edited by podenphant on 09-15-2000 at 03:10 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