Turret has target and container does something

Get help using Construct 2

Post » Sun Aug 17, 2014 12:13 am

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?
B
11
S
2
G
1
Posts: 79
Reputation: 842

Post » Sun Aug 17, 2014 6:33 am

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.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sun Aug 17, 2014 6:36 am

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 ...
B
11
S
2
G
1
Posts: 79
Reputation: 842

Post » Sun Aug 17, 2014 10:12 am

ThomasP wrote: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: unexpected-picking-with-containers-and-families_t93975

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"
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sun Aug 17, 2014 3:46 pm

Ahh, I see. Thank you for that link. I wasn't aware of that.
B
11
S
2
G
1
Posts: 79
Reputation: 842


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests