Turret has target and container does something

0 favourites
  • 5 posts
From the Asset Store
A well commented Dynamic Heart Containers template to learn from or to use as a base for your own game!
  • I have a gun turret with the turret behavior in a container with a ship that has the bullet movement that is used for basic movement. When the turret has a target, I want the bullet movement of the base to slow down, then if there aren't any objects in range, I want it to return to the normal movement speed.

    So basically, how do I select one container object when something else in the container has a special condition met?

  • I think in your case, just have the condition Gun turret has target, and the action should be ship: set speed to...

    And have also Gun turret has NOT a target, ship: set speed to...

    Since you said they were in the same container, they are always picked together.

  • I tried that, but it was selecting all ships, not just the one in the same container. Thank you for confirming what I thought it was supposed to do, though. Maybe I'll set that up again and see if I can find something else in the code that is causing the problem.

    Would it make a difference that all the gun turrets are in a family and all the ships are in a family? So it actually has the gun turret family has a target, then the ship family bullet speed is set to ...

  • I tried that, but it was selecting all ships, not just the one in the same container. Thank you for confirming what I thought it was supposed to do, though. Maybe I'll set that up again and see if I can find something else in the code that is causing the problem.

    Would it make a difference that all the gun turrets are in a family and all the ships are in a family? So it actually has the gun turret family has a target, then the ship family bullet speed is set to ...

    Indeed, families and containers do not work well together, and it is a known issue that will not be fixed:

    In that case, you would have to do the correct picking yourself, I am not able to currently use C2 at the moment, so all I can do is suggesting either to do the conditions for each type of gun turret (easy but troublesome), or to store the UID of the ship inside a family variable of the gun when they are created together, and vice versa so you can add the condition "Ship: pick by unique id, the variable that contains it from the gun"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ahh, I see. Thank you for that link. I wasn't aware of that.

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