Sign in to follow this  

Better approach to colliding with bricks...

This topic is 4832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I attempted this before in code, and it was a mess... so im trying to get it right before i hit the code. I have a ball travling around the screen, I want to have bricks around the level to be obstacles for the ball, but id like more than bricks id like walls (vertical, horizontal) that can make as paths for the ball. So since the bricks are now in the version of this game im making going to be 32x32 (or some square to fit in amap of sorts) how is the best way to get collision from the ball to the bricks to bounce the ball away ... when i tried this in my old game engine (C code, not C++, crappy design etc.. etc..) the ball would hit bricks fine usually and go back the other way, the problem was, the corners...if it hit a corner funky things would happen like it bouncing up and through the brick... and the likelyhood of hitting a corner went up when i strung a bunch of 32x32 bricks across in a line or a verticle wall one after another. So I must ask...what kind of collision detectoin am I looking for here? the data structures to my ball is: BallVx BallVy BallX BallY Data structure for brick: X Y (ya fun) there is a max VX and VY of course. I asked this long ago and got answers back like: Use normals Line intersetcions etc.. But i feel im ready to tackle this again and prepared to do whatever it takes to make it work well...so any ideas BEFORE i actually code myself into a corner :) heh. Thanks for answering and letting me revive a dead horse topic. (it should be mentioned this code is going on an armbased PalmOS machine) Shane

Share this post


Link to post
Share on other sites
I know absolute zero about mobile device programming, so I can't tell. I "guess" you would.

It says advanced because the original poster felt to name the thread that way.

Good luck!

Share this post


Link to post
Share on other sites
Ya, I found out I amlooking for a box-sphere collision that has to do with some aabb sweep crap. I was hoping to just plug in a method that does the collision detectionb ased upon the data set I already had in my brick, and ball classes (which is just an X Y and a vx, vy both int's) but apparently vectors are the way to go...what a pain. Hmm one would think brick collision is easy but heh not so much. Then I still have to work out if it collides HOW did it collide so I know how to reflect the ball correctly.



Share this post


Link to post
Share on other sites

This topic is 4832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this