How do I only click 1 object instead of 2

  • So i make smash game,where u click to kill it

    then,there's enemy which being overlapping with each other,when i click it,it kill both.

    how to make it kill enemy at the above one first instead killing both enemy?

  • give the sourse file

  • So i make smash game,where u click to kill it

    then,there's enemy which being overlapping with each other,when i click it,it kill both.

    how to make it kill enemy at the above one first instead killing both enemy?

    Ok. Enemy = sprite. Add additional object (sprite2) and global variable (number) "clicker".

    1)Mouse=>On left button clicked on Sprite=>(System) Set clicker to sprite.IID , Create object Sprite2 on layer ... at (mouse.X, mouse.Y)

    2)((Sprite2=>On collision with Sprite) and (System=>clicker = Sprite.IID)) => Sprite destroy and Sprite2 destroy

  • I'm not sure if I understood correctly

    You only want to destroy the top sprite (obj_Enemy) from the stack.

    Here you could make another condition to your "on clicked" object event.

    obj_Enemie pick top instance

    Edit: is a Z Order thing where now only the top one gets destroyed

  • im sorry,i don't really quite understand that,my c2 is free version anyway

    here's the wrong one,when click,it destroy both of them,can u guys change it to the right one so will destroy one by one

    dropbox.com/s/6q10eyvnihefk4z/test.capx

  • here is the shortest version I could think off - was before I saw you fixed the link

    https://www.dropbox.com/s/ayjjho6fdn01i ... .capx?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just looked at your file - so it's basically the same as mine. You don't have to take touch OR mouse. Touch works with mouse as well.

  • here is the shortest version I could think off - was before I saw you fixed the link

    https://www.dropbox.com/s/ayjjho6fdn01i ... .capx?dl=0

    Cool,thx for helping man.but can u add second object?,i tried with 2 different object and failed

  • The easiest way - if possible - is instead of using another object just to use the same object, but with another animation/frame. Otherwise it gets a little bit more complicated.

    But if you only change the animation depending on which enemy - everything stays the same.

  • Use pick top/bottom instance, condition

  • If you would use the C2 personal edition it is also very easy.

    Just make a family with all your different enemies and take the same code and only change from sprite to family in the event sheet.

  • The easiest way - if possible - is instead of using another object just to use the same object, but with another animation/frame. Otherwise it gets a little bit more complicated.

    But if you only change the animation depending on which enemy - everything stays the same.

    Thanks man,it work,manage to make multiple enemy on single sprite and it killl 1 by 1 now..thx alot

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