x


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 :(

more ▼

asked Oct 07 '11 at 09:55 PM

Purri gravatar image

Purri
1 1 1 1

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.
more ▼

answered Oct 08 '11 at 06:33 AM

roamcel gravatar image

roamcel
1.2k 37 40 44

(comments are locked)
10|3000 characters needed characters left

Yes indeed i have 2 prefabs for walls , and marker is underwork, its not problem. But now main problem is how i draw that path from point A to point B and how to allways snap build marker on corner of tile?

I hope you guys can give answers !

more ▼

answered Oct 08 '11 at 07:25 PM

Purri gravatar image

Purri
1 1 1 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3739
x662
x534
x454

asked: Oct 07 '11 at 09:55 PM

Seen: 1540 times

Last Updated: Oct 08 '11 at 07:25 PM