Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bounce angle and collision calculation #35

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

schlagmichdoch
Copy link
Contributor

Added some logic to enable the ball to move at any angle and calculate the reflection angle physically correct (not always 90°). (should fix #1)

Added a simple loop to calculate (but not draw) every step a ball takes which prevents missing blocks (#22).

Added a detection function to check whether the opposing ball is inside the square that is about to change color. This should fix #6

Supersedes #34

Copy link

vercel bot commented Feb 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
pong-wars ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 12, 2024 9:32pm

@schlagmichdoch
Copy link
Contributor Author

@vnglst I saw that you have reimplemented some randomness to your code. Have you tested whether this PR resolves the tunneling issues? If you think about merging this PR I would resolve all conflicts.

@vnglst
Copy link
Owner

vnglst commented Feb 16, 2024

Hi @schlagmichdoch, thanks for the effort you've put into this. Looking at your code it seems you've solved some important issues, but the code is also longer and more complex. My original implementation was naive, but easy enough for others to also give it a go. I would like to propose the following: Let's create an alternative version (either to this PR or your Github repo) and link to that from the README.md. How does that sound?

@schlagmichdoch
Copy link
Contributor Author

Sure, go ahead, use this PR as you like, I will leave it as is. I don’t need to get credited, I just like the idea and wanted to offer some improvements to help others get the ball behavior right.

I will take another look at your code and try to find some less intrusive ways to optimize the collision detection though. Especially the tunneling problem might be easy to solve with only a few changes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stuck in endless periodic loop :-( Sometimes ball punches tunnel
2 participants