Sims like building script, picture and webplayer included

Hi,

Im currently doing game , and one element on that game is building rooms. Try this webplayer to see my current progress. Webplayer link HERE

As you can see, you can build “walls” (way too big ) by clicking any free tile on grid. But im looking for similar building system what sims games has. Check this picture
alt text

First player click on any tile edge on game, see A. then player will move mouse cursor to the B, and there appears"ghost" wall between point A and B , if player clicks second time, real wall appears.

How to do it? I have tried to find a logic behind this but looks like i cant figure this out without help. Im not asking that you write code to me , im asking you show me the way or give idea how to continue!

Please, help me :frowning:

My approach to this would be to actually use two different classes for the ‘wall’.
The first class is the ‘ghost wall’, and the second one is ‘real wall’:

  • click once, place construction marker, enter ‘ghost wall mode’ (something like just toggle keeping your mouse down in your app)
  • you actually create a rectangle of ghost prefabs (could even just be a transparent version of the ‘real’ prefab) from the ‘marker’ up to the mouse cursor
  • when you click again, you copy the ‘path’ of ghost wall to a path of real walls, so basically you can even possibly make both walls subclasses of ‘wall’. then exit ghost mode.

A* path finding will allow you to build the walls from point a to point b. As for snapping the marker, you can either set the XYZ to that of the tile, or just round the number to the nearest multiple of the grid’s cell-size.

Hope you get it working, I’m currently doing a lot of research into the elements of a Sims-like game.