Distance problem

0 favourites
  • 3 posts
  • I think there may be a simple solution to this, either something in C2 or a trigonometry answer (I think one of the basic trig rules covers this but can't remember it).

    I have two points that I wish to know the distance between, but all I know is their start location (the centre of the screen), their angle and their distance from that point. Since I want my screen to be stretched, I can't used C2's built-in distance function.

    So I guess if I know one corner of a triangle and the length and angle of the two sides coming from that point, is it possible to work out the distance between the two other points?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is, and you don't need any trig for it. This will tell you the distance in pixels:

    distance(sprite1.x, sprite1.y, sprite2.x, sprite2.y)

    scirra.com/manual/126/system-expressions

  • It probably sounded like I know the locations of my sprites, but I don't. I'm placing them by moving them both a certain distance from the same location, but the screen can be stretched so I need to know the distance between them regardless of screen size.

    So basically I know the point of a triangle, and the 2 angles and sides coming from that point. I'm trying to then calculate the length of the third side.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)