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 / Checking Collision on Sides of Boxes

Author
Message
Sakuya
15
Years of Service
User Offline
Joined: 16th Feb 2009
Location: IB*ET
Posted: 4th Mar 2009 20:33
Hi

I'm new to DBP and i tried to write a game (dont remember the name, it's similar to Pong)
The Idea is that when the Ball (Box) hits a Brick (Box) then it gets deleted and continues to fly around, like if it hits from right and is flying up the Ball goes now right and up because it hit the Bricks right side and so on from every side.

But somehow it sometimes hit the Bricks but gets the wrong direction.
I realy dont know why, i tried to figure it out for an hour but i dont realy get it.

I included the Code and the Program so You can try it out

here the Main code


Here the Functions.dba

Attachments

Login to view attachments
feiting shadow
18
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 9th Mar 2009 05:24 Edited at: 9th Mar 2009 05:25
I played your game, it seems the only problem is when the ball hits the top or bottom of a brick from the right side.

I don't use sparky's DLL, and personally only update objects once in any game loop, so I'm not gonna dig through everything, but I believe your code's flaw is in the upper and under collision. Possibly due to the fact you have +1 and -1 for your left and right values changing for the X, but -1 and +0 for the y. The pairs don't look like they match for the y values. Also I just now figured out Y is the 2D X axis since you're in 3D, heh... so that might be it. Sorry nobody's taken a look at your code, this has more work behind it than some posted programs.

Signed
------
kuljot
15
Years of Service
User Offline
Joined: 2nd Jan 2009
Location: sacramneto, ca united states
Posted: 9th Mar 2009 05:53 Edited at: 9th Mar 2009 05:54
ill look at your code and post something tommrow. that games caleld blasterball. and hey im workign on a game liek that too so maby we can work togeather or soemthing.

programmign is stressful yet great. remeber one thing keep keep trying and you will succeed.
Sakuya
15
Years of Service
User Offline
Joined: 16th Feb 2009
Location: IB*ET
Posted: 11th Mar 2009 07:31
thanks for the reply

@kuljot

so blasterball it's called
and yeah if you like to then we could try to work together

@feiting shadow

i saw that i havent changed the 0.5 in 1 in my code but it still doesnt change the behaviour.

Quote: "Also I just now figured out Y is the 2D X axis since you're in 3D, heh... so that might be it."


What exactly do You mean by that?

Login to post a reply

Server time is: 2024-09-28 02:25:51
Your offset time is: 2024-09-28 02:25:51