A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: jumpTo()?

  1. #1
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139

    jumpTo()?

    couldn't really think of a title to explain it.

    say i have three variables

    gravity Y

    velocity X

    velocity Y

    and i wish to make an object jump to a position based on a passed Y velocity value which returns the appropriate X velocity to get to the destination

    function getJumpX(px, py, dx, dy, y){

    }

    var gravity = .5
    var vy = -10
    var vx = getJump(0, 0, 100, 0, vy)

    i honestly have no idea where to start

    any ideas?
    lather yourself up with soap - soap arcade

  2. #2
    When in doubt ask Eager Beaver's Avatar
    Join Date
    Feb 2007
    Location
    Planet Earth
    Posts
    911
    You can use curveTo class given Flash 8 help.
    -Bezier curves.
    Code:
    lineStyle(2, 0xFF0000, 100, true, "none", "round", "miter", 1);
    moveTo(0,400);
    curveTo(250,0,500,400);
    <signature removed by admin>

  3. #3
    Senior Member
    Join Date
    May 2006
    Location
    Manhattan
    Posts
    246
    Quote Originally Posted by Eager Beaver
    You can use curveTo class given Flash 8 help.
    -Bezier curves.
    Code:
    lineStyle(2, 0xFF0000, 100, true, "none", "round", "miter", 1);
    moveTo(0,400);
    curveTo(250,0,500,400);
    lol

    you need to factor for time, mr_malee.

    the equation you should be looking for is:
    velocity * time + 0.5 * acceleration * time * time

  4. #4
    When in doubt ask Eager Beaver's Avatar
    Join Date
    Feb 2007
    Location
    Planet Earth
    Posts
    911
    Yeah! great!
    Please see the earlier thread and posts/discussions on a similar thread!

    http://board.flashkit.com/board/show...1&page=2&pp=20
    <signature removed by admin>

  5. #5
    Im still young
    Join Date
    Mar 2006
    Location
    world
    Posts
    38
    The trajectory of the object can be a quadratic curve, cubic curve or a higher order curve.
    I have developed the attached FLA in Flash 8, taking into consideration a quadratic curve.
    Select the values of ym, x0, y0, x1, y1, and click play button. The object moves from x0, y0, to x1, y1, through ym in a parabolic trajectory, drawing a parabolic curve.

    Homepage
    Attached Files Attached Files
    Last edited by Achyut; 04-07-2007 at 01:53 PM.

  6. #6
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    great, thanks for the help everyone. Achyut you especially

    just wondering though what the different variables mean, i think i've figured out a few but theres one that eludes me

    ballym. It looks like its supposed to be the height of the jump, however when i set these values up:

    x0 = 200
    y0 = 200
    x1 = 100
    y1 = 100
    ballym = 0

    the ball doesn't go to 0 at the height of its jump, just not sure what values this can be and how it alters the jump. ballym makes sense when both y0 and y1 are equal and ballym is different, the ball seems to pass through at the correct height. But when y0 and y1 have different values and the distance between them can be negative, i get a little lost with the ballym variable

    thanks for the help anyway
    lather yourself up with soap - soap arcade

  7. #7
    When in doubt ask Eager Beaver's Avatar
    Join Date
    Feb 2007
    Location
    Planet Earth
    Posts
    911
    You are 100% correct mr_malee!
    Primarily I have included ym to create depth of the parabola.
    if y0=ym=y1, you draw a straight line.
    ym(actual) corresponding to (x0+x1)/2 is equal to ym(set) only when y0=y1.
    in all other cases ym(actual)=ym(set)+(y0-y1)/2.
    To construct a general quadratic curve I have to use the formula
    y=a*x*x+b*x+c
    for any arbitrary values of a, b, and c set by the user.
    In the present program I have used the formulas:
    x=x0+vx*t;
    y=y0+vy*t+0.5*g*t*t;
    and
    boundary conditions set by user:
    initial: (x0,y0)
    final: (x1,y1)
    middle: ym corresponding to (x0+x1)/2
    Hope I will be able to do further work on this fascinating subject.
    Last edited by Eager Beaver; 04-10-2007 at 02:04 AM.
    <signature removed by admin>

  8. #8
    Im still young
    Join Date
    Mar 2006
    Location
    world
    Posts
    38
    Quote Originally Posted by Eager Beaver
    You are 100% correct mr_malee!....
    Clarification Please.
    Actually I and Eager Beaver (my colleague) have together developed this movie. As I was busy with some other work I asked Eager Beaver to post
    a reply.
    The reply may be considered to have been given by me.
    I am extremely sorry if any confusion was created.

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