Ball Bouncing Help

BlitzPlus Forums/BlitzPlus Programming/Ball Bouncing Help

daaan(Posted 2005) [#1]
Hi, I wanted to create a mini golf game in bplus or bmax. One problem is I can't figure out a way to make the ball bounce off of walls( strait walls, weird angled walls, etc... ). Ive searched the archives and haven't found anything that I can use. Anyone have any ideas or the know how?

thanks,

-Dan


Oso(Posted 2005) [#2]
Depends how accurate you want to make it. I thought of a visually effective but physically inaccurate trick on the Amiga. I kept a hidden bitmap with the solid objects to be bounced off having colours corresponding to the directions normal to the walls. Say if a wall was angled 45 degrees upward to the right, I coloured the underlying bitmap red along its bouncing edge - blue if it was 45 degress down and so on. The little ball tested the colour of the hidden bitmap and if it found red it changed direction appropriately.

If you used only eight wall directions you could change the direction of an arbitrary velocity without any trig at all and, for a miniature golf game it was good enough and looked surprisingly realistic.

I suppose there is no need to dodge true calculation now as things are faster. It would probably still work though if you want something very quick and easy.


daaan(Posted 2005) [#3]
thanks, i'll give it a shot.