Synchronizing Layers

A game I am designing includes a piece which can appear in 3 states, A, B, C.

These are defined as 3 different image levels which loop via a CTRL Z keystroke. We’ll call this “frontLayer”

“frontLayer” also includes a Randomize keystroke. The reason for this is not relevant to the issue. It is necessary within the mechanics of the game.

The same piece has a second “movedLayer” comprising altered images of A, B, C. to mark when the piece has been moved. These cycle on the same keystroke as “frontLayer” (CTRL Z), so that the images in both remain in synch.

Naturally a problem arises when the Randomize command is used, since this will alter the state of “frontLayer” leaving “movedLayer” unchanged.

What I am trying to find is some means of re-synching “movedLayer” to “frontLayer” - i.e., “movedLayer” should be automatically cycled to match.

I thought this could be achieved using a Trigger Action, but either that is not so, or I am defining my parameters incorrectly, or I need to go about this in an entirely different way.

It can be achieved by using a numeric dynamic property - call it “follow me”
When “frontlayer” changes (CTRL Z) the dynamic property “follow me” sets its
value (CTRL Z) to $frontlayer_Level$
Set “movedlayer” to follow a property - “follow me” w/ level 1 = 1 and
remove its CTRL Z on it altogether

When you randomize “movedlayer” (CTRL R?) also set the DP “follow me” to do
the same thing as the CTRL Z on the DP but with CTRL R

Post generated using Mail2Forum (mail2forum.com)

Thanks for the tip, Tim. I had tried something like that, but couldn’t get it right. I didn’t know about the dollar signs.

I expressed joy too soon (i.e., before I tried it). No go. I assumed, of course, that the numeric property should be set to 1 to 3, wrapping. I tried it with the dollar-signs and without. The state of the moved layer never changes. Or perhaps it does, but when I toggle it visible, the layer goes back to its own level 1? Does it matter where the dynamic is relative to (above/below) the layers with which it associates?

Hi Miyazakigrognard,

Yes there was a slight problem with my described method - missed a part (needed trigger), which is easy to do at 3am :slight_smile:

Ive attached a demo inside the zip showing how to do this for all those interested.
All four possible layer commands are accounted for (Increase, Decrease, Reset and Randomize)
Should be fairly straight forward.

Obviously this can be expanded upon for as many layers as you require to synch

Any questions just ask

Tim

Thanks Tim!

That did it. I was also working on short sleep. The funny thing is, I had had been trying to do it with a Trigger, completely missing the Dynamic Property angle, whereas you gave me the DP and missed out the Trigger.

Well, all sorted now, and I’ve learned a valuable trick in the process.

Thanks again,

Mark (or Mac - depending)

I am trying to reconstruct the module (lost alas!) for which I originally needed this solution. However I cannot get a solution analogous to the “synch.zip” upload (above) to work properly. Also, I need for the piece to have the “following” layer hidden from view except when the piece is flipped after moving. Then the “moved” (“following”) layer should activate. I know I had successfully done this before, but I cannot remember how. Please help as this is driving me nuts. Thanks!