Morphing shapes

So, in my app you click on the canvas and your cube expands. I was wondering if I could have the cube move around other cubes?

Normal

If colliding

My arrows in the image arent appearing but I want it so when you click on the canvas the cube moves in positions that arent already filled by other cubes.

This sample project is close but not an exact match:

Thanks!