How do I select one instance on touch

Get help using Construct 2

Post » Sat Dec 10, 2016 9:06 pm

Hello guys! This is my first post on this forum and english is my second lenguage so sorry in advance.

Ive been making a little mobile game that you can collect coins by touching them, they simply add 5 to a global variable and just destroy the instace. My problem is when multiple coins are overlapping and you touch them, they all get destroy and for some reason they only add up 5 value when should be adding 5 for each instance (I dont know why this happends...).

My question is How do I only select one instance ( maybe the closest one to the touch input or the one with more value ) on touch?

Thanks guys!
B
2
Posts: 3
Reputation: 156

Post » Sat Dec 10, 2016 9:22 pm

Please send pictures of your event sheet, so I can see the exact problem. Try making an event using the coin on collision with the player -> add 5 to the global variable and destroy.
B
8
S
3
G
3
Posts: 13
Reputation: 2,130

Post » Sat Dec 10, 2016 9:35 pm

Chances are just adding For each coin will fix it.
ImageImageImage
B
71
S
21
G
233
Posts: 3,696
Reputation: 130,368

Post » Sat Dec 10, 2016 9:45 pm

Message: kamens503 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Thanks for the quick reply but, its on touch even no on collision with player.

Heres the screenshot
http://pasteboard.co/8gFqBuoed.png

@blackhornet its not what i was asking for but it may work! Let me try
B
2
Posts: 3
Reputation: 156

Post » Sat Dec 10, 2016 9:50 pm

blackhornet wrote:Chances are just adding For each coin will fix it.


This should solve you problem :)

Or you can use a Pick nearest/Furthest or Pick top/bottom to only select 1 if that is what you need
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,838

Post » Sat Dec 10, 2016 10:10 pm

Thanks guys!

It worked with highest value
B
2
Posts: 3
Reputation: 156

Post » Sun Dec 11, 2016 6:17 am

you couldv just move the destroy above the wait 0.2 and i think wold be fixed... adding the wait time, the contained clicked item wold be lost, and then destroy wold apply to all familly members.
B
75
S
22
G
69
Posts: 1,341
Reputation: 43,779


Return to How do I....?

Who is online

Users browsing this forum: NN81 and 25 guests