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.

DarkBASIC Professional Discussion / BrickBreaker collision woes

Author
Message
Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 2nd Apr 2010 04:20
Hello everybody, I've been trying for the past day or so to create a BrickBreaker clone. The part that's just got me stuck is the ball colliding with the top of the "bricks" or blocks as they're called in the code.

I've tried setting up collision zones, and then just trying to reverse the speed of the ball so it doesn't go downwards anymore, but neither worked. I've commented out the collision code I wrote and the program is currently set up to send the ball directly down the y-axis to the block below it.

Any help would be appreciated.

Here's my full source code:


Note: The code related to all ball collision/movement is in the function called BallControl() and block health management and drawing in the function called ManageBlocks()

Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 2nd Apr 2010 17:17
Nevermind, I figured it out. The if statements in BallControl() were overriding each other.

Dar13
18
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 3rd Apr 2010 05:01
Ok, I've got another question(please pardon the triple post, I didn't want to make another thread). How would I go about detecting if the ball hit the side of the block?

Here's what I've got so far:


Any help at all is much appreciated.

Login to post a reply

Server time is: 2026-07-26 21:11:54
Your offset time is: 2026-07-26 21:11:54