Please help with logic. Broke his head.

  • Not how to make a condition on it, I have already tried everything.

    How should work.

    When a police car is created and it moves, it has a siren. When the car arrives at the stop and stops, a policeman comes out of it. If a policeman is standing nearby (a field is superimposed on him that checks whether he is standing with the car), the car’s siren continues to flash. If a policeman is killed and no policeman gets into the field anymore, then the siren of the car no longer flashes.

    And this condition should work for every new car.

    I can not do it, because if one condition works, then it applies to all new cars and it turns out that they are already driving without sirens, or if a policeman is killed, then all cars that have the same siren can also be killed.

    Help please do not know how to be.

    Project:

    yadi.sk/d/u660gSEL69Q6KQ

  • The police detector doesnt relate to a car in any way so when you destroy police it doesn't do anything or picks all cars. First question, do you really need police detector? You can just use police is overlapping car directly. Best way to resolve it is when a car spawns police, set police instance variable to car.UID. Then when police is destroyed you pick car which matches UID and turn off siren.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I use the detector only because the police appear next to the car and do not overlap it. By this I took the detector.

    I do not quite understand how to work with UID. More precisely I do not understand at all.

  • Well my method takes out the need for overlap checks so he can be next to the car. UID is an identifier for each object. Under your spawn police action you have set police.variable to car.UID.

    You then have car with UID 999 and police with variable 999 for example so they relate.

    Then you say police on destroyed, pick car by UID : police.variable and then turn animation off.

    It is just a way of relating the police to the car, something which you don't have right now.

  • I'll try, thank you very much

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