The idea of my solution
So, with the description above I evaluated step by step what should be done and what should happen.
– First, simply creating the cubes of course and then my “one step back” button.
– Second, I would want to store my click event from every cube inside a array.
– Count up my clicks with an increment number on each click.
– Store each individual click inside the correct array from the clicked cube.
– Let the back button find out what the last click has been with a Math through the array’s of the cubes.
– Determine in which array/cube that last click has been and move that cube back.