Moving Multiple Objects

Phil Davis davis.phil at comcast.net
Thu Mar 9 02:52:22 EST 2006


Hi Judy,

I'm pretty bleery-eyed at this time of day, but I reorganized your code 
slightly and got improved (I think) results. Here's what I did:

on preOpenCard -- no changes here
   set the loc of image "BStone1.gif" to 326,152
   set the loc of image "Bstone2.gif" to 215,155
   set the loc of image "BStone3.gif" to 268,242
end preOpenCard


on openCard -- removed some code
   set lockMoves to true
   move image "BStone1.gif" to 588,-72 in 2 secs without waiting
   move image "BStone2.gif" to -65,-21 in 2 secs without waiting
   move image "BStone3.gif" to 290,459 in 2 secs without waiting
   set lockMoves to false
end openCard


on moveStopped -- new handler
   if the movingControls <> empty -- something is still moving
   then -- defer action
     exit moveStopped
   end if

   -- if all movement has ended, GO!
   visual effect dissolve
   go next card
end moveStopped


See if this does what you need.

Phil



Judy Perry wrote:
> Hi Phil,
> 
> I used a preOpenCard handler to handle the initial locations of the three
> images, then an openCard handler to handle their movement.
> 
> Here is the entire card script:
> 
> on preOpenCard
>   set the loc of image "BStone1.gif" to 326,152
>   set the loc of image "Bstone2.gif" to 215,155
>   set the loc of image "BStone3.gif" to 268,242
> end preOpenCard
> 
> on openCard
>   set lockMoves to true
>   move image "BStone1.gif" to 588,-72 in 2 secs without waiting
>   move image "BStone2.gif" to -65,-21 in 2 secs without waiting
>   move image "BStone3.gif" to 290,459 in 2 secs without waiting
>   set lockMoves to false
>   wait 15 ticks
> ual effect dissolve
>   go next card
> end openCard
> 
> Any other ideas???
> 
> Gratefully received...
> 
> Judy
> 
> On Wed, 8 Mar 2006, Phil Davis wrote:
> 
> 
>>Have you tried starting it from an 'openCard' handler? I'm thinking the
>>preOpenCard start might be hosing something, since the card is not yet
>>drawn at that time. (At least that's how I think of it.)




More information about the use-livecode mailing list