Better approach to colliding with bricks...

Started by
3 comments, last by Codejoy 19 years, 7 months ago
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
Advertisement
follow the yellow linky
[size="2"]I like the Walrus best.
Thanks, it says advance though,d oes advance mean Ill have to hack the crap out of it to work on a mobile device? :)
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!
[size="2"]I like the Walrus best.
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.



This topic is closed to new replies.

Advertisement