0 Favourites

In same x,y

This forum is currently in read-only mode.
  • Is there a crafty function to use to check if there is an object at the exact same x and y as another? I am trying to make a system to automatically delete remnants in my system. I need to get it so that if I spawn more than 1 of an object, it deletes them. I was wondering if there is a crafty way or a function to check if there's an object in the EXACT same X,Y, and not just an object that may overlay. Thank you

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • <img src="http://xs123.xs.to/xs123/08032/xy241.jpg">

    (Now here's where I get a reply saying "No, no, I meant this" because the question was too ambiguous to decipher correctly.)

  • Yeah, sorry, I should have specified it better. What I really meant was the same exact object placed on top of itself. The problem with using that logic for the same object is that it won't be able to tell the difference between the two. Thanks

  • Objects use floating point values for their coordinates in Construct. Due to how floating point values work on processors the objects may appear to be at the same place, but their X and Y coordinates will differ ever so slightly. You would probably want to round the coordinates and just test to the nearest pixel. You would do it like this, using compare values:

    round(Sprite.X) equal to round(Sprite2.X)

    round(Sprite.Y) equal to round(Sprite2.Y)

    If you want to test multiple 'Sprite's with this method, put a 'For each Sprite' condition at the top.

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