# Distance(x1, y1, x2, y2) vs Collision with hidden object.

0 favourites
• 11 posts
From the Asset Store
1000 x 1000-pixel tile set sheet for your awesome 2d games
• Which one is more labor intensive for Construct 2?

Physics are not being used.

If Distance is less intensive for the system you could prevent the need of using collision detection.

I'm not sure how Collisions are handled.

Distance(x1, y1, x2, y2) seems more beneficial because it is easier to work with, and is seemingly only 1 mathematical calculation.

Collision seems like it would be the same or similar calculation, plus it would have to render hidden objects and resize/destroy/create them as needed.

I read a few times that collisions can take up a lot of resources.

Just curious on which one would be easier for devices.

• I prefer collision detection/overlap. Burt only when used as first conditon in a top level event.

• The way it is structured is important. It should almost always be the top level event.

It just seems like Distance would be easier for most cases and would be easier on the system.

• It would depend on the shape of the collision area.

Also you would have to create a picking mechanic for multiple instances as distance won't do that for you.

That means it will probably be slower.

Or you could just use line of sight.

• Collision would probably be better for random uncontrollable cases. I suppose if the situation is specific then it would be better to use Distance.

How would I use Line of Sight? That is only to see if an object can be 'seen'.

• It has a range.

• I think "distance" uses the Pythagorean Theorem, so there would be squaring and square roots involved. I'm not 100% certain, but I think it would be lighter computation to do compare X and compare Y. That would allow for collisions between rectangular objects, whereas distance would treat everything as a circle.

• I'm not 100% sure what you mean by compare X and compare Y?

I think I would have to compare X and Y on all sides of the object that way.

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads