Help with multiple enemies

  • Hi. Please, help! Im very new in Construct 2. Im learning while I make a plataform & sword game.

    My problem is: when there is only one dragon in game, the game works great. You can play it here: https://db.tt/q1ORicv2.

    But when there are two dragons, it does not matter which one I hit, the two flash and die even if one was untouched. You can see the capx here (it has platform+ installed): https://dl.dropboxusercontent.com/u/106 ... arian.capx

    Please, help!

  • Right click on Draco and select "clone object type". Don't use ctrl+drag.

  • When you test a condition in construct -- did foo collide with dragon? -- any actions you take within that event only affect the instances that fulfill that condition -- the dragon that was hit.

    However, when you call a function, the function itself doesn't know anything about the condition that led to it being called.

    Now, you can tell the function, but that requires passing it some data that allows it find the instance again. This is called the uid. You feed this to the function by passing it as a parameter, and you select the object by 'picking' it, using the condition pick by uid within the function.

    An easier way of going about this, in most cases, is to use families to test for collision events, allowing you to minimize redundant events, while still having multiple object types.

  • Now, you can tell the function, but that requires passing it some data that allows it find the instance again. This is called the uid. You feed this to the function by passing it as a parameter, and you select the object by 'picking' it, using the condition pick by uid within the function.

    An easier way of going about this, in most cases, is to use families to test for collision events, allowing you to minimize redundant events, while still having multiple object types.

    Thanks, i will try that. Thank you very much.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey I know I'm years late but could you go into detail how you would pass the UID into a function and have it pick the right instance. I'm having the same problem, I tried doing what you said TiAm but it didnt work, so i must be doing it wrong. Please help

  • Here you go another user had same problem today

    http://www23.zippyshare.com/v/Q6nvlYcM/file.html

    Press right arrow on computer keyboard to move right and collide with the circles. The circles will be destroyed only when you collide with them. Have fun only one line of code!!

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