How to select only the object that's touching the player.

Get help using Construct 2

Post » Fri Sep 09, 2016 1:33 pm

To expand on the Title; If I have multiple of the same object, how do I target (to change the animation of and take the X/Y of) ONLY the instance of the object that is touching the player?
I like giving game advice more than I actually like making games ;)

Image
B
40
S
16
G
3
Posts: 129
Reputation: 4,701

Post » Fri Sep 09, 2016 1:45 pm

'on collsion' or 'on overlap' (found in the sprites conditions) selects the player as well as the overlapping sprite(s).
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Sep 09, 2016 2:40 pm

Yeah, but does it target only the single instance of the object that's overlapping? Or won't all of the objects be selected? My situation is that I have duplicate instances of the same object (copy+paste in the editor for now), and I want to select ONLY the one that is overlapping. And then I should be able to retrieve that object's X/Y.

TL;DR I'm pretty sure that still targets all instances, not just the one. I can't test it currently, since I'm not at a computer.
I like giving game advice more than I actually like making games ;)

Image
B
40
S
16
G
3
Posts: 129
Reputation: 4,701

Post » Fri Sep 09, 2016 4:20 pm

I'm sure the action only happens to the one that intersects with the player however just to be sure you can include a

Player X is overlapping Object

statement and might as well include other actions in there like the object's animations, other properties...
Image Image Image
B
32
S
12
G
27
Posts: 761
Reputation: 17,244

Post » Fri Sep 09, 2016 5:09 pm

Yeah, I'll try a few things later and respond back with an answer (just in case others are interested in this too ;) )
I like giving game advice more than I actually like making games ;)

Image
B
40
S
16
G
3
Posts: 129
Reputation: 4,701

Post » Fri Sep 09, 2016 6:21 pm

B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Fri Sep 09, 2016 7:09 pm

TabloidA wrote:Yeah, but does it target only the single instance of the object that's overlapping?


'on collsion' or 'on overlap' (found in the sprites conditions) selects the player as well as the overlapping sprite(s).

All sprites that, on the moment of checking, overlap the other sprite. Meaning, if you got multiple sprites overlapping, you mostly should use 'for each sprite'. Or combine it with a pick condition that filters some more.

None overlapping sprites are not selected.

'on collisions' Is bit different in the sense that it is a trigger. Triggers can happen multiple times in a tick. It happens collision by collision. So it sets objects 1 by 1 selected.
Last edited by 99Instances2Go on Fri Sep 09, 2016 7:19 pm, edited 1 time in total.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Sep 09, 2016 7:18 pm



Modified your capx to clearly show things.

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


(hope it was ok to be lazy, you did most of the work allready)
Last edited by 99Instances2Go on Fri Sep 09, 2016 8:19 pm, edited 1 time in total.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Sep 09, 2016 7:50 pm

No problem, 99Instances2Go, but it seems the capx file is identical to the one I uploaded earlier. Haha! :mrgreen:
B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Fri Sep 09, 2016 8:20 pm

Ty for pointing that out ! Updated link. Now out looking for a brain.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests