How do I add turret target for object in family?

0 favourites
  • 13 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • 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

  • 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.

  • 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?

  • Yes I think so. Assigning turret behavior separately to each of the family members fixes this.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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...

  • 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.

  • WOW!!!...this is awesome! this is what I want! thank you man for your clearly explanation. Really useful concept.

  • 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.

  • dop2000, thank you!

  • 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!

  • dop2000

    Hi Dop, one more question.

    I am making a Game that need to run on iOS, android and PC. Mostly the game will run on mobile phones, and need to be in HD.

    It is a Clash Royal like game, and I need the set the window size.

    What is the best window size do you think for my game?

    I have played your Andriod puzzle game, what is the window size for your game?

    Thanks!!

  • In Doptrix my window size is dynamic. I actually started developing it on a phone with 320x240 screen

    So it works equally well on any resolutions from 320x240 to FullHD and maybe even higher. But I didn't develop it in C2.

    For my new C2 game I decided to go with HD resolution (720x1280), but I'm not 100% sure it's the right choice.

    If you are making your game for PC, maybe consider FullHD?

    Here are a few posts I found on this topic

  • OK Thank you! I will try and check the posts!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)