Can two points collide? ( not two surfaces )

Get help using Construct 2

Post » Mon May 11, 2015 11:06 pm

hello

I want that when the coordinate x1 , y1 of a moving object collides with the cordordenada x2 , y2 an action is executed. That is I want to collide two points , not two surfaces. is it possible?

thanks in advance
B
5
Posts: 34
Reputation: 295

Post » Mon May 11, 2015 11:44 pm

You would have to test the distance of both the points to do that. Using a local or global variable to compare on every tick. Something like this to test out. You might have to play with the distance. cause it depends on where the origin point is set for this it was to 64x64 sprites with the origin set in the middle.

Image
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Mon May 11, 2015 11:45 pm

Short answer - No.

Longer answer:
You could check if x1 is the same as x2 and y1 is the same as y2,
but if these are moving objects it will allmost certainly never happen.

You could check if the distance between those points is less than a certain distance and have that call the actions ..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon May 11, 2015 11:47 pm

@PhoenixNightly

To get the distance between two points in pixels you can just use the expression - distance(x1,y1,x2,y2)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon May 11, 2015 11:58 pm

Thx LittleStain
Raise the comparison up half the width of the sprite should work. :D
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Tue May 12, 2015 8:17 am

thank you very much to both.

When testing these options and I will tell to you if I have any doubt
B
5
Posts: 34
Reputation: 295


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, tarek2 and 26 guests