The title basically says it. I need to know this.
I thought of an expression, but I can't use that because I can't directly enter it (i.e., there is no condition "if expression is true", as far as I know)
Please. Help.
The title basically says it. I need to know this.
I thought of an expression, but I can't use that because I can't directly enter it (i.e., there is no condition "if expression is true", as far as I know)
Please. Help.
Never mind, I found it.








I was just about to post a new topic about this. I need to know the same thing, so you figuring it out without telling anyone isn't helping me.
What I'm trying to figure out is, how do I go about making an object change states when the player is within a certain number of pixels of that object?
Any takers?


Use the Advanced Direction Object. Test for Distance between points is equal or less than however much, do stuff you want to do.

No need for advanced direction object, you can do this:
ALWAYS
--- Object: Set 'distance' to:
sqr( (x("Object") - x("Target")) pow 2 + (y("Object") - y("Target")) pow 2)
OBJECT: 'Distance' > 100
--- (do something)
Do it that way, and it'll work with object selection. If you don't want to use the formula, just replace it with the advanced direction object's expression instead.
The formula's really easy once you know how it works, I'm working on an animation to explain it, but for now, I'll write a small article.
If you need to do lots of distance checks an extension will be faster though... At least it was in MMF1.5, haven't checked in MMF2.








I tried useing that extension, as recommened, but I've run into a snag.
I'm trying to make it so that when you are within a certain number of pixels of a certain floor tile, it springs out spikes.
Instead what occurs is that when you get within a certain number of pixels of the floor tile, they ALL spring out spikes.
Anyone run into this before?
I'm using the Advanced direction object, and the code is as such.
-->The distance between player and object is 50
Then Change object's animation to (Spiked)








I did get the forumla to work without the extension though. I'll go with that if it doens't cause slowdown.
The reason all spikes react is because all spikes get picked by that one event. Splitting it into 2 events as in Dines example will fix this.

Well the article and example are both done, so if you ever wondered how the distance formula works, or want to see a couple of simple examples of stuff you can do with it, just mosey on to:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=92782#Post92782