Algorithm for Direction Change upon Collision

Ender Nafi Elekcioglu endernafi at
Tue Nov 12 19:46:14 EST 2013

Jim hi,

It will be a sparkle animation.
I know that it’s a useless gimmick for a business app,
but my customer insists on it.

Touching a control should throw a couple of sparkles, little curved elliptic images.
Tricky part is if they collide new -but less in amount- sparkles should be generated.
After 3 - 4 seconds, the animation will end.

Hockey pucks is my initial phase to construct the basic handlers of generating objects and handling collision.
Since the objects are too small, I’ve noticed in my tests that swapping the directions on collision is good enough.
There is no need to deal with momentum in my case.

By the way, I downloaded Kaleidoscope; I’ll study it.


~ Ender Nafi
On November 13, 2013 at 2:29:29, Jim Hurley (jhurley0305 at wrote:

I guess I didn't understand what you want to achieve. If it was simulating the game of air hockey you really can't avoid doing a realistic collision between pucks. But if it is simply moving a lot of objects around the screen, then maybe the interaction between them would be irrelevant and you would ignore collisions altogether, just collisions with walls.  

See for example "Kaleidoscope Deluxe" in the User Samples (Rev On Line).  
Go to the third card (Click box in the lower left hand corner until you arrive at "Bouncing Balls.") And set the velocity to the max.  

use-livecode mailing list  
use-livecode at  
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:  

More information about the Use-livecode mailing list