Pencil Code Reference > sync

 

sync synchronizes turtles

sync is used to synchronize turtles or sprites.

If you want to correct sprite timing by synchronizing with other sprites, you would use sync.

sync will make any listed sprites pause until all of them reach that same point in the animation before proceeding to any animation commands after it.

sync is one of the commands that manipulates animation queues.

r = new Turtle red
g = new Turtle green
p = new Turtle purple
r.bk 100
g.fd 100
g.rt 90
g.fd 100
sync r, g, p
r.fd 100
g.fd 100
p.fd 100

You can also control an element's speed and timing by using speed to set the number of moves per second and pause to pause a turtle while other turtles perform actions.