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
4
G
3
Posts: 13
Reputation: 2,280

Post » Sat Dec 10, 2016 9:35 pm

Chances are just adding For each coin will fix it.
ImageImageImage
B
71
S
22
G
267
Posts: 3,807
Reputation: 147,745

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
45
S
11
G
2
Posts: 1,186
Reputation: 6,881

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
78
S
23
G
69
Posts: 1,355
Reputation: 44,041


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests