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 6335907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:56:49+00:00 2026-05-24T18:56:49+00:00

Now I’m making a pong game in c++, and by now I’ve made a

  • 0

Now I’m making a pong game in c++, and by now I’ve made a paddle and ball which both inherits from entity that holds the coordinates and the bounding box(can be circle or polygon) of the entity, also I’ve implement a function entity.isColliding(entity) which easily telling if the entities are colliding for any two entities.

Now I want to make the Ball move and when it will collide with an entity it will reverse the right speed coordinate(x or y). I thought of making a function canMove() which will move and check collision and if there is move back, but I have no idea how to check if I need to reverse the x or the y speed coordinates all I know is that there was or will be a collision.

Any suggestion?

  • 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-05-24T18:56:49+00:00Added an answer on May 24, 2026 at 6:56 pm

    Hm, if I understood your problem correctly… Reversing the right one of the speed coordinates makes your ball resume it’s travels the way it should, while reversing the other one makes it just resume to go into the wall (but from the different angle).

    I don’t know how fast your canMove() function is, but if it’s fast enough maybe you could try it this way:
    – reverse the x coordinate, if it works, that’s the one
    – if it doesn’t work, then reverse the y coordinate
    – if both of these don’t work then you’re in a special case situation (e.g. corner) — reverse both 😀

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

Sidebar

Related Questions

Now that FDT no longer supports fdt.launch.Application from AIR projects, how do you go
now i'm working on a project for creating audio unit instrument that provide the
Now I try to developing an application related to Image processing, for that I
Now I'm trying to display the result of consuming a webservice from one page
Now I have a 1-dimonsion NSArray, each element of which is a NSMangedObject with
Now that my facebook app has got more than 1000 likes -- https://apps.facebook.com/156485447732146/ But
Now that we soon have user defined literals (UDL), in GCC 4.7 for example,
Now i want to read any excel file that are given by the user
now, i want to modify the comment reply link,the effect which i love is
Now this might look like a duplicate thread, but my question is that I

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.