strategy game building placement

Hey, does anyone have a code or can tell me how it works?

You know the way you place a building or stucture in a strategy game, where you use the mouse to move a builsing that slides agains the ground

Or if you got a code that works like a logic brick for

Mouse move up
Mouse move down

and also left and right

Maybe this can help:

Take look at the answer, it tells everything!