How do I make the enemies not destroy at the same time?

0 favourites
  • 15 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hello everybody!

    I've set an event so that every 2 or 3 seconds an enemy spawns. The problem is that when the player destroys one they all die (even if there's like 5 on screen).

    How can I fix that?

    Thank you in advance!

  • How is the player destroying the enemies? You can give the destroy event some condition to tell construct what enemy you want to destroy. Are you using a trigger?

    Post a screenshot so we can see how you set up the events.

  • How is the player destroying the enemies? You can give the destroy event some condition to tell construct what enemy you want to destroy. Are you using a trigger?

    Post a screenshot so we can see how you set up the events.

    Hello!

    The player destroys the enemies when the player touches them. The enemy is a line (for now) and at the end of every side of the line there's 2 sprites that when they touch the player they kill it.

  • you cant have more then one destroy events for the same object after the first one the object that the is associated with the condition get destroyed first then the next is making the rest get destroyed. unless those are other objects and we just cant see.

  • you cant have more then one destroy events for the same object after the first one the object that the is associated with the condition get destroyed first then the next is making the rest get destroyed. unless those are other objects and we just cant see.

    Yes, those are other objects but since I'm testing if they destroy or not I painted them with a red color (normally they're transparent).

  • Hello everybody! I'm still not able to fix this, I don't know why it's doing it!

    If you guys want I can post the capx file

  • Think that's a good idea

  • Here it is!

  • You have a picking problem, when the player collide with, for instant "Barritaentera" you destroy "Barritalzquierda" and "BarritalDereccha" as well. (Sick names btw ) But you never pick which of these to destroy, so it just automatically pick all of them and then destroy them. You have to pick the correct ones of "BarritalDereccha" and "Barritalzquierda" as well, and the same goes for all of your "On collision" events.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You have a picking problem, when the player collide with, for instant "Barritaentera" you destroy "Barritalzquierda" and "BarritalDereccha" as well. (Sick names btw ) But you never pick which of these to destroy, so it just automatically pick all of them and then destroy them. You have to pick the correct ones of "BarritalDereccha" and "Barritalzquierda" as well, and the same goes for all of your "On collision" events.

    Ohhh ok! And how can I pick which ones I have to destroy? Thanks for the tip btw

    Regarding the names, haha they're in spanish as I am spanish!

  • I've been trying a lot of different things and I still can't get it fixed

  • This kind of depend on your design. But from what I get from looking at the game, you have the line in the middle and to this there are linked two other objects to the end, which if the player touches them they kill hims. So you could do it, so when you create the line and the end points, you store the UID of the line as a variable in the end points.

    Create Line
    
    Create End_point_1
    Set Parent_UID = Line.UID
    
    Create End_point_2
    Set Parent_UID = Line.UID
    
    On Collision Player with line
    Pick End_point_1.Parent_UID = Line.UID
    Pick End_point_2.Parent_UID = Line.UID
     [/code:32doi3q8]
    
    This way of doing it is not really the best way of doing it, but since you don't use families etc. and I guess you are fairly new to C2, if im not wrong, then this way is probably the easiest and then you can always change it later.
  • This kind of depend on your design. But from what I get from looking at the game, you have the line in the middle and to this there are linked two other objects to the end, which if the player touches them they kill hims. So you could do it, so when you create the line and the end points, you store the UID of the line as a variable in the end points.

    > 
    Create Line
    
    Create End_point_1
    Set Parent_UID = Line.UID
    
    Create End_point_2
    Set Parent_UID = Line.UID
    
    On Collision Player with line
    Pick End_point_1.Parent_UID = Line.UID
    Pick End_point_2.Parent_UID = Line.UID
     [/code:2mnusz9n]
    
    This way of doing it is not really the best way of doing it, but since you don't use families etc. and I guess you are fairly new to C2, if im not wrong, then this way is probably the easiest and then you can always change it later.
    

    Thanks for the help!

    Yes, I'm pretty new to C2 haha

  • here mate if you still need it i made a easy to follow enemy creation /destroy and platform movement for u cheers.... people here tend to overreact with their coding .... when even isn't needed

  • here mate if you still need it i made a easy to follow enemy creation /destroy and platform movement for u cheers.... people here tend to overreact with their coding .... when even isn't needed

    Hey thanks!! Awesome man!

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