Hello there
I currently have a little project, and I need to calculate just about all the time the distance between an object that will be assigned to the mouse and another object, and there's a difference in what happens the further they are (there are 3 levels of distance possible).
Anyway I've been wondering, considering this is supposed to be a pretty object-heavy frame, what's a better approach - creating 2 invisible circular active objects to move with the non-mouse object, and they will represent different radiuses of distance from the player, and once you overlap one of them with the mouse - the appropriate action;
or the other option being 3 events using the Pythagoras theorem.
In "better approach" I mean what would be more efficient to do, because that's one of the most basic elements in this application, and I wouldn't want to find out later that what I created is too processor intensive because I cut corners on such things.
There are extensions like math and direction objects I believe, but I don't like using extensions to do simple tasks. Your best bet would be to just use a distance formula imho.
SquareRoot((x1+x2)^2*(y1+y2)^2)
I'm sure I'm going to look like a dumbass if I got that wrong, but it's been a while and I don't feel like looking it up.
its actually a very cumbersome formula to implement over and over again in a game. Use the advanced math object, it has it as one of the options, and is highly efficient.
Thanks, I searched for the advanced math object and it directed me to Cellsoft's website and a 404 error, does anyone happen to have the object uploaded somewhere? (MMF2)
Originally Posted by Pixelthief its actually a very cumbersome formula to implement over and over again in a game. Use the advanced math object, it has it as one of the options, and is highly efficient.
Couldn't it be coded as a behaviour of the mouse object? The only problem a behaviour though is the lack of qualifiers.