Building system

Get help using Construct 2

Post » Mon Feb 20, 2017 7:37 pm

hi there im trying to make a building system but im trying to make it universal and save tons of coding by using families. but im not sure how to use families to do what im trying i was debating using UID but im wondering if anyone can help

so how it starts is ive got loads of building plots (all in 1 family)
on family clicked i want the system to know what object was click while bringing up a menu off what to build, then on building clicked place that building where the selected building plot is.

i was debating doing it on family clicked set variable to family.uid
and then somehow construct building at uid.variable. the problem is i hear UID is very unreliable
B
15
S
5
Posts: 134
Reputation: 1,617

Post » Tue Feb 21, 2017 12:07 am

You can do it two ways. You could not use families as families are only needed for when you're applying something to all of the buildings. So when you select building C from the menu, you just create building C, no need for families.

Or you can use family instance variables. You have a family of buildings, bldA, bldB, bldC. If you go to the menu and select bldC, it creates a building, and sets family instance variable type to C and elsewhere you have logic that links C to the animation, properties of bldC.
B
46
S
16
G
73
Posts: 2,086
Reputation: 43,681

Post » Tue Feb 21, 2017 12:14 am

hi there thanks for the reply, i did debate not using families but i thought that would require alot of coding and was wondering if i could make it easier but it seems i have to do it the long way :(

thanks again for replying
B
15
S
5
Posts: 134
Reputation: 1,617

Post » Tue Feb 21, 2017 12:29 am

There is probably a shorter way of doing what you are planning to do. Describe the exact building steps and selection as it's not totally clear with the plots and buildings.
B
46
S
16
G
73
Posts: 2,086
Reputation: 43,681

Post » Tue Feb 21, 2017 4:36 am

okay, im gunna have about 15 plots which u can click

once clicked it will bring up a menu off buildings

you can click on a building and it will build it at the selected plot
B
15
S
5
Posts: 134
Reputation: 1,617

Post » Tue Feb 21, 2017 9:17 am

Give the plot family a boolean variable, something like isSelected. When clicked set the variable isSelected to true for that plot. When the list of buildings comes up, build the selected one on the plot that is set to isSelected=true.

Logic will be something like :

Plot(family) on clicked, set family instance variable isSelected=true, load building menu.
Building (from menu) on clicked, create building at plot(family) where isSelected=true.
Plot(family) set isSelected=false. (clear)
B
46
S
16
G
73
Posts: 2,086
Reputation: 43,681

Post » Tue Feb 21, 2017 2:36 pm

i knew something simple was out there :) i would of never thought of using a Boolean. thanks a lot man :D
B
15
S
5
Posts: 134
Reputation: 1,617

Post » Tue Feb 21, 2017 3:29 pm

I gamble that you have a problem with families spawning (building) a random member. In the first place.

But that is easily to overcome. And without plugins. So, i (am still so free to) guess that you want to do something like this.

https://www.dropbox.com/s/7jp4h4otlshsa ... .capx?dl=0

Families is the way to go.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Feb 21, 2017 5:00 pm

thanks for the reply and i never had random spawning, but i was thinking of trying UID to pinpoint, but i felt this was the wrong approach so i thought i would ask everyone before experimenting, im using families now and yeah your right they work a treat :D
B
15
S
5
Posts: 134
Reputation: 1,617


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Shenkai the ssj and 24 guests