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 / collision detection problem on pong

Author
Message
newblenderbeer
14
Years of Service
User Offline
Joined: 2nd Jun 2010
Location:
Posted: 25th Jul 2010 18:09
I've been learning darkbasic from a book that is full of mistakes. Normally this isn't a problem seeing as I can find and fix any problems. I've just finished a pong game and I've fixed most of the bugs but there's a problem that I just can't find. I think it's the collision detection but I haven't used it before so I'm not sure. I think this is where the mistake is.


For some reason the ball keeps rapidly changing direction between left and right while repeatedly playing the sound indicating that the ball has been hit.

In case I'm wrong, here's the whole program.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Jul 2010 23:21 Edited at: 25th Jul 2010 23:21
The code isn't great but lets just assume it's for learning purposes for now (Point is a really slow command)

This should fix it...



Once you have collided, you have to detect when you have uncollided. I would imagine that what you have done is effectively stick to the paddle because you never leave it.

The alternative would be to undo the last move so you don't embed yourself in the paddle.

Zorkonian12
14
Years of Service
User Offline
Joined: 28th Jul 2010
Location: Why would I tell you?
Posted: 30th Jul 2010 05:35
Do you mind telling me what book you were learning from? I'm learning from a book too and I just want to make sure its not the same one

Good luck on your project! Unfortunately I can't supply any help since I'm still learning.

-I would like to change the Universe, unfortunately they never gave me the source code...

Login to post a reply

Server time is: 2024-11-24 13:56:29
Your offset time is: 2024-11-24 13:56:29