Add the objects to a Family and also use a Family instance variable for position.
Randomness depends on what is allowed in your game. If it can be any object in the family and repeated then you can just 'create family' repeated 18 times, each time add 1 to the position variable and add +distance*var to the X position.
For the sliding, assuming the above that they are all numbered in order due to family instance variable, when you destroy 'Family' store the family instance variable in a local variable, then pick all 'Family' objects where var is greater than the local variable and set their X to self.x-distance, or use move to behaviour to set their position and move them to self.x-distance.