Splitting enemy

0 favourites
  • 9 posts
From the Asset Store
Give Sound to the enemies that are part of your game! :)
  • I have an animation for an enemy type which splits into two of itself. There are two image points in the animation for where to spawn the two new enemies however my code does not work:

    <img src="http://i.imgur.com/2ceOD.jpg" border="0" />

    It spawns one enemy at image point 1 but none at image point 2. Strange things also happen.

    Any tips?

  • I couldn't tell you exactly what's going wrong there, but from the looks of it Construct might be getting confused that there's so many "Enemy"s running around. The problem's probably in picking instances of it. I have trouble with that myself, so I'll save us all the headache of me trying to offer a solution. <img src="smileys/smiley18.gif" border="0" align="middle" />

  • i'm not sure, but i believe it's the order of your events for the animation.

    you destroy the enemy, then you try to make reference to it, for spawning. i think you have to make your references first while it still 'exists', then destroy it. you can make it invisible while you do your spawning.

    hope that helps...

  • not sure exactly but feels like construct is not picking the right instance . Least that's what it seemed like when I recreated your example.    But I did get it to double the way I expected by making each Spawn action a sub-event of the initial Event as a way to keep it picking the original

    if that helps.

    example .capx

    Warning the example .capx makes a lot of sprites rather fast.

  • onzephyr Your method is good but there are a few bugs when I use it for my purposes. See the problem here:

    dl.dropbox.com/u/41931267/Splittr.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It seems to be splitting correctly. What is it not doing. Or doing that's unexpected?

    nice smooth animation by the way.

  • Well as you can see the correct amount of sprites are being created but they are jumping to strange positions...

  • Is this closer to what you were expecting?

    dl.dropbox.com/u/22615804/Splittrer.capx

    I would say that the ordering and unspecific instructions are the problem, but I've tried with and without a For Each condition and it functions pretty much equally (I left it in though). I've placed the destroy event before and after the creation events, same thing.

    So I changed it from the object itself spawning the new objects to simply creating them with the system create object action. what you can do with spawn object from object you can do with system create object, just better imo. I think there may be an issue with how c2 picks objects that are created by other objects. However, I'm just guessing.

  • inkBot It seems to work. Will there be problem when there are all different enemies everywhere splitting at different times? That is what I need.

    EDIT: never mind, it works fine (I took out the 'for each' loop).

    Here is a (quite cool) example .capx

    dl.dropbox.com/u/41931267/Splittr.capx

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