How do I check if an object is overlapping a circular area?

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi,

    I want to check if an object is overlapping a circular area around another object. How can I go about doing this? I tried using "is overlapping at offset" but I am getting inconsistent results. (Maybe I don't know the right equation?) I don't want to use an invisible sprite as I have multiple objects that need to be checked.

    Basically if an object comes in a circular proximity of another object, I want to the first object to do something. Is using line of sight a way to do this?

    Any help will be greatly appreciated.

  • I guess you could use distance(object.x,object.y,object2.x,object2.y)

    This would calculate the distance between imagepoint0 of object1 and imagepoint0 of object2

    if this distance is less than 100, object2 would be within a circle of 100 px around the center of object1

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you! It was super simple. just never thought of it this way!

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