How do I only click 1 object instead of 2

Get help using Construct 2

Post » Thu Mar 17, 2016 1:09 pm

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?
B
3
Posts: 4
Reputation: 183

Post » Thu Mar 17, 2016 1:54 pm

give the sourse file
B
3
Posts: 7
Reputation: 189

Post » Thu Mar 17, 2016 2:40 pm

Zulkarmi wrote: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
B
3
Posts: 7
Reputation: 189

Post » Thu Mar 17, 2016 2:51 pm

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

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Thu Mar 17, 2016 3:45 pm

Message: Zulkarmi can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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
https://www.dropbox.com/s/6q10eyvnihefk4z/test.capx?dl=0
B
3
Posts: 4
Reputation: 183

Post » Thu Mar 17, 2016 3:51 pm

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

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Thu Mar 17, 2016 3:53 pm

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.

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Thu Mar 17, 2016 3:58 pm

Message: Zulkarmi can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
fm4fanAT wrote: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
B
3
Posts: 4
Reputation: 183

Post » Thu Mar 17, 2016 4:02 pm

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.

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Thu Mar 17, 2016 4:12 pm

Use pick top/bottom instance, condition
B
22
S
3
Posts: 74
Reputation: 1,515

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests