Algorithm for Direction Change upon Collision
feed at smpcsupport.com
Sat Nov 9 00:36:29 EST 2013
Your original post about particles, made be wonder about how many moving images
LiveCode can support. There is a stack here:
That solves the problem of the "trembling clumps" and handles 100 particles and
possibly more depending on the fps you are aiming for. (This is on an older
desktop PC, I haven't tried it on a mobile device.) I was also going for a more
random effect where the particles go every which way. It was done on LiveCode
The "tricks" to this demo are:
1. Don't even try real physics, if it is just for visual effect, near enough is
2. Don't underestimate the speed of text lists in LiveCode. When the number of
items is measured in the hundreds, avoid using arrays in any code that is
repeated in a loop.
3. Somewhat paradoxically, more code in the loop that does the screen updating
is actually faster if the logic used is more efficient.
Note this stack has the acceleratedRendering set to false. On some platforms
setting it to true may make the animation smoother.
"Components, Controls, Tools and Resources for LiveCode"
More information about the Use-livecode