Algorithm for Direction Change upon Collision

RunRevPlanet feed at smpcsupport.com
Sat Nov 9 00:36:29 EST 2013


Hi Ender,

Your original post about particles, made be wonder about how many moving images
LiveCode can support. There is a stack here:

http://livecodegamedeveloper.com/download/100-Particle-Test.livecode

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
Community 6.1.2.

The "tricks" to this demo are:

1. Don't even try real physics, if it is just for visual effect, near enough is
good enough.

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.

--
Scott McDonald
"Components, Controls, Tools and Resources for LiveCode"
www.runrevplanet.com




More information about the Use-livecode mailing list