Hi,
I want to get the distance between to sprites, but they are the same objects (just copies). I know that I can use two diffrent objects to avoid that, but in my game I have more than 2 copies, and I don't want to create a new sprite for each of that.
The code for example:
distance(Sprite.X,Sprite.Y, Sprite.X,Sprite.Y)[/code:12cmdlgh] Is there a way to pick the second instance of the object? The code above returns 0, due to the fact that it doesn't calcualate the distance between the two instances but of its own. Thanks for your help in advance! Regards Andy
You can use the iid sprite(iid).x if you know the id's beforehand.
Ah didn't know that this is possible. I'll try that. Thank you!
Develop games in your browser. Powerful, performant & highly capable.
Families also help solve this kind of problem.
Thanks for that hint. How do I do that? Do I just use the family.X/Y then?
Thanks!
Without more details, it's hard to be specific, but in the worst case you can put all objects in two Families. Then you can do distance(FamilyA.X,FamilyA.Y, FamilyB.X,FamilyB.Y)
Now I got it! Thank you!