### How do I use an arbitrary expression for a condition?

Posted:

**Wed Oct 21, 2015 12:34 am**I need to have, as a condition, a test for the distance between the sprite and a certain target point.

Currently I'm doing it in this ugly way:

Four conditions:

target X < self.X + 10

targetX > selfX - 10

targetY < self.Y + 10

targetY > self.Y - 10

This works but I feel like if I could have an arbitrary expression, then I could simply have one condition that went something like Distance(self.X, self.Y, targetX, targetY) < 10

But what kind of condition do I need to make where I can enter an arbitrary condition. This seems like a very powerful thing one could do (arbitrary expressions on a particular obect for a condition. But I don't see a way to do it.

Currently I'm doing it in this ugly way:

Four conditions:

target X < self.X + 10

targetX > selfX - 10

targetY < self.Y + 10

targetY > self.Y - 10

This works but I feel like if I could have an arbitrary expression, then I could simply have one condition that went something like Distance(self.X, self.Y, targetX, targetY) < 10

But what kind of condition do I need to make where I can enter an arbitrary condition. This seems like a very powerful thing one could do (arbitrary expressions on a particular obect for a condition. But I don't see a way to do it.