Moving images around randomly

Barry Levine themacguy at macosx.com
Mon Nov 25 15:02:01 EST 2002


I am developing an app that will have a number of fairly small images 
on one screen; maybe 50 pixels square. I was thinking about using image 
objects (but will listen to any suggestions). The app will have these 
objects moving about in the upper half of the window in a manner that 
I'm sure has some mathematical model. Imagine balls moving randomly 
about, each proceeding in a straight line, bouncing off the "walls" 
-and- off each other. There does not need to be any exact "precision" 
in terms of the angles at which the bounce occurs nor will the movement 
of any object be especially fast; actually, fairly slow is what we 
want. Furthermore, each of the "balls" will need to respond to a 
mouseUp event (which I know I can do without a problem).

Before I try to re-invent the wheel, has anyone done or seen anything 
similar to this (that you would like to share)? I would imagine that 
the code resides in each object. I also would think that the direction 
of each object's travel will need to be mapped to a variable that 
changes as the object collides with another object or one of the 
"walls".

How am I doing so far?

Thanks,
Barry




More information about the use-livecode mailing list