15,921,716 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 11238660 (Top 2 by date)
Member 11238660
17-Nov-14 6:03am
View
I'm aware that the physics make no sense, but Pong has always been like that. It has really bizzare unreal physics to make the game more challenging and fun.
Member 11238660
16-Nov-14 23:01pm
View
I think I figured out what the intersectY is. It seems like it's actually the value of the Paddle's Y middlepoint position MINUS Ball's Y Position (if the ball hit anywhere between the middle and the top part of the paddle) or the Paddle's Y middlepoint position PLUS Ball's Y Position. Which means it would always give a value between -50 and 50 depending on where it hits (my paddles are 100 pixels in height).
Unfortunately, I did apply the formula in the link but to no prevail. Despite being inside the IF statement of a collision, sometimes it actually goes through the paddle even though it detected a collision due to this formula, and the angles are all messed up with it flying off at random directions.
So I guess that formula is not the correct way to do it then. Do you have any other method of achieving a way to bounce the ball off at angles?
If all else fails, I'll resort to splitting the paddle into 3 sections and applying an angle based off on that, though that wouldn't replicate the true nature of pong since it bounces at a different angle based on each individual pixel of the paddle.