How do I add turret target for object in family?

Get help using Construct 2

Post » Sat Sep 30, 2017 6:17 pm

https://www.dropbox.com/s/4twdtshupxbhdit/GameDemo.rar?dl=0

Hi,
Here is my demo. I am in trouble with setting turret's target for objects in family.

What I did:
I made a troop object and a tower object.
I package them into a family call TowerAndTroop.
I add Turret behaviors for TowerAndTroop family.
In the event sheet, I set the tower's turret target to troop.
In the event sheet, I set the troop's turret target to tower.

How ever, when I run in debug mode, I checked the tower's target UID is the tower its self.

Hope you can help me on this.

Thank you

Ken
B
10
S
1
Posts: 15
Reputation: 498

Post » Sun Oct 01, 2017 1:52 am

Why did you add them to the same family?
If you really need them to be in the same family, remove turret behavior from the family and add it to both Tower and Troop objects separately.

You can actually assign several turret behaviors. For example, use separate turret behaviors on Tower and Troop objects to shoot at each other. And use family turret behavior to shoot at wild animals.
Check out my awesome game Doptrix
B
17
S
9
G
51
Posts: 839
Reputation: 28,487

Post » Sun Oct 01, 2017 2:37 am

OK I see. So if I use the turret behavior of the family. and set target for both tower and troop, the C2 engine will confuse to set which object's target?
B
10
S
1
Posts: 15
Reputation: 498

Post » Sun Oct 01, 2017 2:42 am

Yes I think so. Assigning turret behavior separately to each of the family members fixes this.
Check out my awesome game Doptrix
B
17
S
9
G
51
Posts: 839
Reputation: 28,487

Post » Sun Oct 01, 2017 3:01 am

But you know that, if a game have 100 different game roles (like StarCraft), I want to have something like 5 families, for tanks(for big tank, small tank, scifi tank), soldiers, worms, ships, airplanes, and want to set turret target for all the tanks. So in this case, I dont want to write event separately to set turret target for big tank, small tank, scifi tank...
B
10
S
1
Posts: 15
Reputation: 498

Post » Sun Oct 01, 2017 3:28 am

You can add the same object to different families depending on what tasks you need to do with each family.
For example you have these objects:
FriendlyTank
FriendlyTrooper
EnemyTank
EnemyTrooper

You can create Friendlies family (with FriendlyTank + FriendlyTrooper) and Enemies family (with EnemyTank + EnemyTrooper).
Assign turret behavior on both families and set target to each other.

You can also create Vehicles family (with FriendlyTank + EnemyTank) and People family (with FriendlyTrooper + EnemyTrooper).
And then define some vehicle-specific events or behaviors for Vehicles family, and some different events for People. For example, all vehicles will explode when destroyed and all people will leave a blood spot.
Check out my awesome game Doptrix
B
17
S
9
G
51
Posts: 839
Reputation: 28,487

Post » Sun Oct 01, 2017 3:37 am

WOW!!!...this is awesome! this is what I want! thank you man for your clearly explanation. Really useful concept.
B
10
S
1
Posts: 15
Reputation: 498

Post » Sun Oct 01, 2017 3:48 am

No problem! :)

One more thing - if you have 2 objects which are different in appearance but otherwise quite similar (small tank and big tank), you can just make one Tank object with 2 animations.
Check out my awesome game Doptrix
B
17
S
9
G
51
Posts: 839
Reputation: 28,487

Post » Sun Oct 01, 2017 3:48 am

@dop2000, thank you!
B
10
S
1
Posts: 15
Reputation: 498

Post » Sun Oct 01, 2017 3:50 am

for "One more thing - if you have 2 objects which are different in appearance but otherwise quite similar (small tank and big tank), you can just make one Tank object with 2 animations."

Cool, so I dont need to make so many similar objects. thank you!
B
10
S
1
Posts: 15
Reputation: 498

Next

Return to How do I....?

Who is online

Users browsing this forum: maranpis, totoe and 33 guests