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 / Deflecting ball logic

Author
Message
Sli3her
15
Years of Service
User Offline
Joined: 20th Feb 2011
Location: Deep in code...
Posted: 26th Feb 2011 20:54
Recently I've decided to create a re-make of the classic Arkanoid game. I decided to program the game's logic first and use generic graphics until I get it working properly. However, I've run into an interesting problem with the ball not wanting to deflect off of the bricks properly. Either the ball wants to take out all of the bricks on the X-axis or if I change the code a bit, it wants to take them all out on the Y-axis. The funny thing is, I've used this exact piece of code in another project which does work correctly. The function that deals with the ball and bricks is below. Any help would be appreciated! Thanks!

HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 27th Feb 2011 16:38
at a guess have you tried using AND instead of OR here





Dark Physics makes any hot drink go cold.
Sli3her
15
Years of Service
User Offline
Joined: 20th Feb 2011
Location: Deep in code...
Posted: 27th Feb 2011 18:50 Edited at: 1st Mar 2011 22:05
If I use AND instead of OR, the ball bounces off the top and bottom part of the bricks just fine, but if it makes contact with the left or right side of a brick it just plows through the entire row.

{UPDATE]
I've got my problem fixed. Thanks for the help.
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 2nd Mar 2011 14:12
What was the solution?

Coding is My Kung Fu!
And My Kung Fu is better than Yours!

Login to post a reply

Server time is: 2026-07-16 23:19:03
Your offset time is: 2026-07-16 23:19:03