simultaneous movement

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
synaptic
Posts: 11
Joined: Thu Jun 04, 2009 10:47 pm

simultaneous movement

Post by synaptic »

Can someone help me with some simple code to make two graphics move simultaneously? Currently, I've got them both turning to random angles, but they won't do it at the same time... any suggestions? I'm pretty new to Rev and to programming in general, and it feels like I"m missing something obvious...

Thanks!
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn »

Hi Synaptic,
when you issue your move command add "without waiting", that will move both graphics at the same time.
If you have more graphics you want to move at the same time you can issue a set the lockmoves to true / set the unlock moves to true before and after the the commands for moving the graphics, still without waiting.
example: make a new stack and two oval graphics, call them "myOval" and "myOval1". One butto with the following script

Code: Select all

on mouseUp
   set the lockmoves to true
   move graphic "myOval" to random(400),random(400) in random(3) seconds without waiting
   move graphic "myOval1" to random(400),random(400) in random(3) seconds without waiting
   set the lockmoves to false
end mouseUp
regards
Bernd
synaptic
Posts: 11
Joined: Thu Jun 04, 2009 10:47 pm

Post by synaptic »

Thanks!
Post Reply