Animation Via Repeated Loop calls?

John Patten johnpatten at mac.com
Fri May 13 19:42:25 EDT 2011


Hi All...

I'm trying to get my head around the idea of using repeated loop to  
animate objects. These are probably pretty basic concepts, but I feel  
I need to get some basic understanding on things such as interrupting  
a loop, etc.

For example,

On a card there's a graphic object, a field and a button. The button  
contains the following script:

on mouseUp
    if cd fld 1 is "True"  then
      moveTheBall
        put "false" into cd fld 1
    else
       put "True" into cd fld 1

       end if
end mouseUp


on moveTheBall
    --put the loc of grc 1 into tCurrentBallLoc
    repeat 20
    add 10 to item 2 of tCurrentBallLoc
    move grc 1 to tCurrentBallLoc
    wait 25 milliseconds
    if cd fld 1 is "false" then
       exit moveTheBall
       end if
    end repeat
end moveTheBall

This animates the graphic object however my means to interrupt the  
loop don't quite cut it as the trigger doesn't get implemented until  
after the command.

What would be the proper way to interrupt a repeat?  Anybody of some  
simple examples of animating objects via loops?

Thank you!

John Patten
SUSD






More information about the use-livecode mailing list