Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8846657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:03:16+00:00 2026-06-14T12:03:16+00:00

I am designing an archer game. When the arrow hits the target it stops

  • 0

I am designing an archer game. When the arrow hits the target it stops moving. What I am trying to accomplish is to define a formula to predict/get location where the target and the arrow meet on the view.

The problem arises when the arrow got a speed varying on initial velocity and the arrow also have angles. Plus, the images on screen are placed by x - bitmapt.getWidth/2 (same for height, h/2..)

If an arrow moves too fast then I need to calculate an error so the arrow does not miss the target even though they are supposed to be on same x and y as we have that, the arrow moves as X + speed pixels. So I came to something like this!

if(arrow[i].getX() + v0x[i] / 2 >= target.getTarget().getX() && arrow[i].getX() <= target.getTarget().getX() + v0x[i] / 2)

I use the velocity of x/2 to specify the error margin.

arrowX + velocity/2 >= collision point >= targetX + velocity/2

However, it does not work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:03:17+00:00Added an answer on June 14, 2026 at 12:03 pm

    This is a pure mathematical problem, and there are much literature when it comes to collision detection. I propose that you use a library. For 2D I recommend JBox2D. It is a physics engine (used for example in Angry Birds). You get collision detection and much much more 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While designing the class, I always get confused what to put in Constructor and
After designing layouts in Android for a while now, I still cannot get the
In designing a data-entry form, I'm finding it difficult to get the second column,
Im designing a printer friendly page and im stuck trying to alter the font
When designing an API for, say, a game. Would it be better to keep
Designing forms has always been fun, but getting them to send email on the
When designing a form in the IDE, non-visual components (eg TMainMenus, TDatamodules) can be
When designing a C API for configuring a library/utility, I have a co-worker who
Im designing a website, and often I need to present information in a nice
while designing my user control, i encountered the following problem: i would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.