How to Destroy Multiple Enemies Before Moving On?

0 favourites
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • Hi everyone; I need help, I have a little problem... OK, right now, I have it so that when the "greenball" (or bullet) collides with "leveloneEnemy", you win and move on to level 2.

    My question is... for level 2, how do I make it so that you have to shoot or collide the "greenball" with two enemies (leveltwoEnemy1+leveltwoEnemy2) instead of just one of them before moving to level 3? I already have the two sprites for the level 2 enemies made.

    <img src="https://dl.dropboxusercontent.com/u/54192518/example.PNG" border="0" />

    Thanks,

    guannstar

  • Please, any help at all would be appreciated:)

  • You'll want to hold a variable for number of enemies destroyed (typically a global variable).

    + Green Ball: On Collision with Enemy
    -> Add 1 to Score
    
    + Score = 2
    -> End Level

    Also, you should typically wait a whole day before bumping your topic. 2 hours is not a whole lot of time for someone to look at your question and answer it on a forum.

  • Hi, thanks for posting:)

    I don't think I can do it by score, because the point system in my game is meant to be random. Meaning, there's more than one way to generate points, so it's hard to say exactly what score should send you to the next level.

    Do you know what I mean?

  • Give the green slime an instance number variable called health

    When bullet collides with slime, subtract 1 from health

    When health is 0, call your end of level events.

    For level 1 set health to 1

    For level 2 set health to 2

    etc.

  • I don't think that would work either. The green slime is the bullet, so it can't collide with itself. Can't I just put a condition so that the bullet has to hit/collide with both enemies to move on, not just one enemy?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can somebody help me with this... I still can't get this to work:(

  • This is what I've been trying, but yea, it isn't working at all. It should be able to collide with both enemies before moving on to level 2.

    <img src="https://dl.dropboxusercontent.com/u/54192518/example.PNG" border="0" />

  • Do you mean hit one enemy and then another enemy ?

    Because at the moment, what your event does is it checks it is colliding with one enemy and it has to be colliding/overlapping with the other enemy at the same time to be executed.

    If you want to check for a consecutive action (like it goes through an enemy and then another one) use global variables to count the "hits".

    It would be simpler to figure out if you'd post your complete capx directly.

  • Yea, I mean hit one enemy and then another enemy:)

    OK, so I've created the global variables like you said ("varfirstleveltwoEnemy" and "varfirstleveltwoEnemy")... How would I count the hits now?

  • I believe, from your first post, is add a second condition so that you need to destory first AND second level monster thing.

  • That's what I'm trying to do:), I just don't know how to. What would the action/condition path look like?

  • Gimmie a second.. just been watching E3. Doing it now hold tight;

    Edit:

    Ok wow.. I can't add a second condition eg "Collision with Level1 sprite AND level2 sprite.." gimmie a minute to do a variable.

  • http://db.tt/snQMx3Ci

    Hope this helps.

    Bit messy but the concept is there-- work from it :-)

  • OK, I've been trying to work with it, but I still can't seem to get it to work:(

    Does the "or" make it so that the "greenball" will have to hit one enemy, and then another enemy before moving on? Or, does it mean that the "greenball" can collide with either of the enemies to move on?

    Also, do I have to make a new "EnemyCount" variable for each level?

    <img src="https://dl.dropboxusercontent.com/u/54192518/example.PNG" border="0" />

    Thanks a lot,

    Guannstar

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