Use the arrow keys or WASD to slide the purple block around each level's puzzle.  Other blocks will stick to your block AND any blocks stuck to your block.  (If you get stuck you can press R to restart the level.)  Deliver blocks to the appropriate lock to remove them from the level.  Once all the locks in a level are unlocked, the level ends.  Many levels allow you to collect additional blocks along the way to achieve a star rating.  Star ratings unlock bonus and secret levels.