The lack of ability of movement of the object in one direction but the ability to move in the opposite direction in abacus

Hi.I want to make an abacus.The beads should stop when they collide but not be able to drag in that direction but be able to drag in the opposite direction.i use canvas and image spirit.Please help.Thanks

Duplicate of