So I’m hoping a picture’s really worth a thousand words. To explain how Undo Pad v2 works, I thought I’d make a flow chart and a timing diagram. Then I thought, why not try to combine them.
Each row represents the order code is executed during a frame & each row is a separate frame. So time flows left to right, then up to down starting from the reddish events.
The exact sequence is determined by the order of the objects and the order of events in the objects in the project. Deriving the sequence from the project is unfortunately probably an entire topic of its own, but here are some key points
- Some events only execute at 30 fps (so the flow arrows advance down to the next frame)
- Some events execute at the expected 60 fps (so the flow arrows advance to the right within the same frame)
- The conditionals (blue diamonds) and the first subsequent code block inside the conditional both execute in succession during the same frame
- Wait 0 blocks don’t wait a specific amount of time, rather they are a fps independent wait of 1 frame
Key characteristics of the timing
- One pen clone sets it’s X1/Y1 during the same frame as the next pen clone sets it’s X2/Y2. This means the Set X1 & Set Y1 must both be the 1st block in a When Object is Cloned event, while Set X2 & Set Y2 must both be the 3rd block.
- During an Undo, the background redraw and both set positions of the pen redraws occur during the same frame
(Tap picture to enlarge)
Any questions? I hope the diagram is clear
Tagging those who liked the topic