• ### Announcements

#### Archived

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

# Ball physics and collision detection

## 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]

[edited by - Charles Hwang on October 9, 2003 5:49:43 PM]



##### Share on other sites
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 on other sites
Your pseudo-code did not come through correctly.

##### Share on other sites
Anonymous Poster, How so?

Charles Hwang -Also/Previously known as Tazel
Personal >>[MonkeyHumor-Under Developement | E-mail]
Programming >>[NeXe|NeHe|SDL]

• ### Forum Statistics

• Total Topics
628285
• Total Posts
2981836

• 10
• 10
• 10
• 11
• 17