The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Stupid math question

DelzhandDelzhand Registered User, Transition Team regular
edited January 2009 in Help / Advice Forum
It's late and my brain isn't working and I can't figure out how to deal with this. I have two numbers, and I want to reduce them by a number such that their sum is a fixed number. Here's a set of equations I think might be helpful, but I'm not sure how to solve for n:

Xa/n = Xb
ya/n = Yb
Xb + Yb = 8

The only numbers I have to start with are Xa and Xb.

There's probably a very easy answer I can't see.

Delzhand on

Posts

  • His CorkinessHis Corkiness Registered User regular
    edited January 2009
    Did you mean that you start with Xa and Ya? In either case, what are they? There aren't enough equations there to solve that many unknowns.

    His Corkiness on
  • ecco the dolphinecco the dolphin Registered User regular
    edited January 2009
    Did you mean that you start with Xa and Ya? In either case, what are they? There aren't enough equations there to solve that many unknowns.

    Running with being given Xa and Ya, and wanting to figure out n, then:

    n = (Xa + Ya) / 8

    ?

    ecco the dolphin on
    Penny Arcade Developers at PADev.net.
  • His CorkinessHis Corkiness Registered User regular
    edited January 2009
    Did you mean that you start with Xa and Ya? In either case, what are they? There aren't enough equations there to solve that many unknowns.

    Running with being given Xa and Ya, and wanting to figure out n, then:

    n = (Xa + Ya) / 8

    ?

    Oh, right, I misunderstood the question. Never mind me. I just checked, and you're correct.

    His Corkiness on
  • DelzhandDelzhand Registered User, Transition Team regular
    edited January 2009
    Thanks! That's right. Hell, that's basic algebra, but for some reason I just couldn't see it.

    Delzhand on
  • DelzhandDelzhand Registered User, Transition Team regular
    edited January 2009
    Ha, I'm even more retarded than I initially thought. Despite the fact that I dealt with this same problem about a million times when I was working on Metroid Lightspeed, I totally forgot how to fire an angled projectile at a consistent speed.

    float firingAngle = Statics.getAngleRadians(position, target.Position);
    Vector2 shotDir = new Vector2(8 * (float)Math.Cos(firingAngle), 8 * (float)Math.Sin(firingAngle));

    vglol.gif

    Delzhand on
  • His CorkinessHis Corkiness Registered User regular
    edited January 2009
    Wouldn't the direction just be target.Position - position? Then normalise and multiply by the projectile's speed.

    His Corkiness on
Sign In or Register to comment.