Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Help with Collision Detection in PONG

Author
Message
DaveTheStudentAt28
21
Years of Service
User Offline
Joined: 12th Jul 2003
Location: United Kingdom
Posted: 14th Jul 2003 22:17
Yep you guessed it; its my first attempt at a game x-d
It would be a great help if anyone could give me a bit of guideance on my collision detection. More specifically, why does the ball just 'stick' to the bat instead of doing what a ball should do, and bounce dammit!
Notice ive not got around to actually moving the bat yet. One thing at a time!

Cheers,
Dave
trager
21
Years of Service
User Offline
Joined: 5th Feb 2003
Location: United Kingdom
Posted: 17th Jul 2003 17:38
I havent checked this I am just reading the posts on my lunch.

When the ball hits a wall you naturally put it back onto the pitch, well you must do the same when it hits the bat.

if the ball hits the bat try
spritey(n) = spritey(n) - diry(n)
spritex(n) = spritex(n) - dirx(n)
before you do anything else.

Also I noticed this line load image "bat2.bmp",2 place it outside of the main game loop and the program will run much faster.

I wrote a tutorial on advanced collision algorithms a while back, its the sort of stuff that will detect collions and reaction between 2 moving objects regardless of the relative speed. If you think it might help let me know and I'll dig it up.

There is no answer only more questions.

Login to post a reply

Server time is: 2024-11-24 23:07:58
Your offset time is: 2024-11-24 23:07:58