A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Tricky maths question

Threaded View

  1. #1
    Zombie Coder EvilKris's Avatar
    Join Date
    Jun 2006
    Location
    Fukuoka, Japan.
    Posts
    796

    Tricky maths question

    First off, thanks to Malee and co for solving my arrow rotation problem before- working great now.


    I've been stumped by something else now. Maths never was my strong point in school.

    Check out the example pic. As you can see, the archer fires the arrow into basically a wall mc.
    TARGETA= invisible bounding rectangle within the target stand that runs hitTests for the arrow and stops it when it lands.
    TARGETB=frontal perspective view of the target.

    What I want to happen;- the arrow hits TARGETA and then a hole (black circle mc) appears somewhere on TARGETB to represent approximately where it has landed.
    In code-
    - There's no real z depth to the arrow so I'll have to randomize the x position on TARGET B. But the arrow hits TARGETA mc at a certain _y position so I can then use that _y value to estimate a _y position for the hole mc.

    So my question is how do I transfer the y position of the arrow to a suitable y position on TARGET B mathematically? TARGET A and TARGET B are both different heights, and also the target stand is at random locations so I'd have to do something about it's x position.

    Like, convert all the mcs to global x,y and targeta._height-targetb_height+arrow._y?
    Tried all sorts but nothing is working accurately right now.
    Last edited by EvilKris; 08-25-2007 at 03:33 AM.

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