Ball physics and collision detection

Started by
2 comments, last by Spintwo 20 years, 6 months ago
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]
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.
Your pseudo-code did not come through correctly.
Anonymous Poster, How so?

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]

This topic is closed to new replies.

Advertisement