XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Help needed finding a formula

Last post 2/9/2010 7:15 PM by Jim Perry. 1 replies.
  • 2/9/2010 7:09 PM

    Help needed finding a formula

    Okay, I have this fishing game and I'm trying to make the casting look good, so I need to find the halfway point between the fisherman and where he is casting.

    say his X = 100, and the spot's X = 500. I need the middle of those, except The second X varies.

    I think I figured it out, I over think things. But reply if you have a solution.
  • 2/9/2010 7:15 PM In reply to

    Re: Help needed finding a formula

    int x1 = 100; 
    int x2 = 500; 
    int midPoint = x1 + int((x2 - x1) / 2); 

    Jim Perry - Microsoft XNA MVP
    If people spent a minute searching the forums and reading the FAQs before posting I'd be out of a job.
      Got some XNA Game Studio/XNA Framework development info to share with the community? Put it on the XNA Wiki.
        Please mark posts as Answers or Good Feedback when appropriate.
Page 1 of 1 (2 items) Previous Next