I have solved many problems now, but unfortunately I've just found a new one.
Remember. At the beginning of this thread, I was stuck with this situation, because when the player takes the gem and then moves down, the rock was falling to his head. It was necessary to move the zeppelin first so that the rock was not falling any more.
The solution was to use the reverse scan mode. That works as expected in this example. Unfortunately, in other cases, that doesn't work.
For example:
In this case, when the player takes the diamond and moves up, in XOR, here is what happens:
1. Starting position. The zeppelin to the right of the empty space can now move left.
2. The zeppelin has moved. The zeppelin that is now to the right of the empty space can move left.
3. The rock prevents the zeppelin to its right to kill the player.
The player can now move up, and then push down the zeppelin to the right of the rock, and take the last diamond safely.
But, when reverse scan mode is activated in R'n'D, here is what happens:
1. Starting position. The zeppelin to the right of the empty space can now move left.
2. The zeppelin has moved. Good. The second zeppelin should move now, but...
3. Here is the problem!
The zeppelin doesn't move and the rock falls in the empty space.
Therefore, the zeppelin at the top is now free to move, and it kills the player.
However, as you can see in step 2, the situation is almost identical than in the first example in this post. The zeppelin should therefore move before the rock. I guess that it doesn't move because the evaluation of the events continues from right to left and then from bottom to top, and reaches the rock before the second zeppelin.
Note that using normal scan mode works fine! But since I cannot guess what scan mode I need before starting an action, I cannot toggle it when needed. Anyway, it is probably very difficult to do that correctly. And I've read in another thread that the scan is always completed, and if it has been toggled, the toggle happens only during the next full screen scan.
Seems that in XOR, the order of the events is not based on the L/R and D/U directions, but rather on the type of the elements. The zeppelins move always first when they can.
I have envisaged two solutions to this problem.
1. When something moves, the game should pause at least during 30 frames so that a new scan of the entire screen happens. Unfortunately, if I do that, the logic that freezes the player during the moves will not work any more. Furthermore, the game will be very slow! Also, I think that that will not work if an element has a long way to do before being stopped. During its movement, the other elements will start to move. And I'm even not sure it's possible to do!
3. I could block all rocks when a zeppelin starts moving during a very short moment (1 frame?) Maybe it's sufficient to force all zeppelins to move before the rocks. Honestly, I haven't tried that yet, mainly because I don't know how to do that.
Ideally, the scan mode should be from left to right and bottom to top. I think (although I'm not sure) that that could work in all situations. But as far as I know, this combination is not possible.
Any idea?
This level demonstrates the problem.