same object comparing

This forum is currently in read-only mode.
  • What I want to do is compare the distance between 2 instances of Sprite, and then move them away if they are too close. But I don't know how I can do that, I was thinking I could use "compare" and then use the distance formula but I don't see how it would know which 2 instances to choose from.

    Would line of sight behavour be a good solution: checking if SpriteA has "on LOS to SpirteA"?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wouldn't overlapping at offset work?

  • You could use the family picking trick for that, I think.

    Put all Sprites into Foo Family. Then do like so:

    + Sprite distance(Sprite.X, Sprite.Y, Foo.X, Foo.Y) is less than whatever
        -> Move Sprite away from Foo
    [/code:ibzrmbk7]
    
    

    Wouldn't overlapping at offset work?

    How so?

  • oh newt, cheers for the idea. I tried giving the Sprite a massive detector image that surrounds the object and made it a container, then when that detector overlaps another Sprite it moves it away! yay

    edit: oops didn't see your post deadeye, maybe I should try that method too

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