Behaviour - Is it possible to the X and Y coordinates + distances from other objects?

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Is it possible to get the X and Y coordinates + distances from other objects using a behaviour?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You’ll have to refer to the documentation for how to do it.

    Basically you’d access the runtime object, find the list of object types from that, then a list of each instance for each type. Then you can either compare the x y or calculate the distance with:

    var dx=x1-x0, dy=y1-y0

    Math.sqrt(dx*dx+dy*dy)

    Or maybe the sdk has a distance function you can use. Anyways that’s the gist of it.

  • You’ll have to refer to the documentation for how to do it.

    Basically you’d access the runtime object, find the list of object types from that, then a list of each instance for each type. Then you can either compare the x y or calculate the distance with:

    var dx=x1-x0, dy=y1-y0

    Math.sqrt(dx*dx+dy*dy)

    Or maybe the sdk has a distance function you can use. Anyways that’s the gist of it.

    Thanks!

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