• Advertisement

Archived

This topic is now archived and is closed to further replies.

Ball physics and collision detection

This topic is 5310 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am thinking about doing my ball physics and collision detection for pong as follows. I would have a xvec and yvec (direction) vector which would work like this. The starting velocity of a ball would be x=-1, and y=1 (after making the prototype work, I would probably make the start of the game set these values with a random seed/number). So, using the cartestian coordinate system, I would loop it like this and expect to move the ball like this: Would the basic collision stuff check and work out correctly? (pseudocode)
if(y-3>screenHeightMin && y+3paddleFront && x+3                   


Charles Hwang -Also/Previously known as Tazel Personal >>[MonkeyHumor-Under Developement | E-mail] Programming >>[NeXe|NeHe|SDL] Resource >>[Google|Dev-C++|GDArticles|C++.com|MSDN] [edited by - Charles Hwang on October 9, 2003 5:49:43 PM]

Share this post


Link to post
Share on other sites
Advertisement
Uhh, yeah, that''d work pretty well I think...I don''t see why you couldn''t just try something this simple and see for yourself.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Your pseudo-code did not come through correctly.

Share this post


Link to post
Share on other sites

  • Advertisement