I can make a ball bounce around the screen, but how would i make it bounce of of objects, such as other images?
Thanx
Steve
------------------
Printable View
I can make a ball bounce around the screen, but how would i make it bounce of of objects, such as other images?
Thanx
Steve
------------------
NOTE: This is only for X direction:
(Image1.left + width) <= Image2.left for a right collision
(Image1.left) <= (Image2.left + width) for a left collision
Its basically the same in the Y direction.
I think i have a project that might help.... i'll see if i can fish it out...
Found it - it's by no means perfect, but it should give you a start.
Add a form with some shapes on it called shape (index them).
I also experimented with curves, but that was never finished so i commented it out.
Have to attach the file - too long to post.
if you are trying to do circular collision regions, then
Center(Image1)^2 + Center(Image2)^2 >= (Image1.Radius + Image2.Radius)^2
would define a collision. Center() would give you the X or Y coordinate of the center of the object.
Sorry this is all in pseudocode but it should be enough. :)
Quote:
Originally posted by Darkwraith
if you are trying to do circular collision regions...
No, i can do that fine (see attached), it was getting the ball to bounce realistically off the surfaces of convex and concave curves that was the hard part. I just couldn't get my head around the mathmatics of it all.
Thanks for the help though. :)
DOh, forgot to attach the file - and i cant edit the previous post to include it either, ah well, here it is.
damn guys....this is from 1999! :eek: I haven't used vb in over 2-3 years :p
LOL :o
At least i wasn't the one to resurrect it. :D
Darkwraith strikes again, thats two in about 2-3days you've brought threads back from the past, I think I'll have a go at it soon:D:D.
The other one:D
:D
But now we have a thread on collision regions. :)