The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.36 / 5.00 33,851 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 12,195 ViewsUGGGHHHHHHH
I knew this before.
But now i forgot.
how would you find the diffrence between the player's _x coordinate and the enemy's _x coordinate?
i'm using as2.
I know it has something to do with atan....????
help pls.
You wouldn't drink dirty water, So why would you drink rotten milk? Oh, you wouldn't? in that case...
Although practicality beats purity.
Errors should never pass silently.
In the face of ambiguity, refuse the temptation to guess.
Math.tan(Math.atan(enemyx-playerx))
At 12/18/09 12:26 AM, Glaiel-Gamer wrote: Math.tan(Math.atan(enemyx-playerx))
hahahahahahahahahahaha, thumbs up.
Although practicality beats purity.
Errors should never pass silently.
In the face of ambiguity, refuse the temptation to guess.
You wouldn't drink dirty water, So why would you drink rotten milk? Oh, you wouldn't? in that case...
they say the hypotenuse is equal to the square root of the sum of both sides squared.
A^2 + B^2 = C^2
IE:
var xdif:Number = obj1.x - obj2.x;
var ydif:Number = obj1.y - obj2.y;
dist = Math.sqrt(xdif*xdif + ydif*ydif) Signatures are for people who aren't lazy.
At 12/18/09 12:34 AM, RottenMilk wrote: I trust glaeil. thanks.
Actually all of the replies u got would be acceptable depending on what you really wanted (eg the distance between objects, the difference between x pos, etc)
At 12/18/09 12:34 AM, RottenMilk wrote: I trust glaeil. thanks.
well you shouldn't...
Do you know what atan and tan do?
At 12/18/09 12:26 AM, Glaiel-Gamer wrote: Math.tan(Math.atan(enemyx-playerx))
You missed a part
Math.PI*(Math.pow(Math.pow(Math.tan(Math.atan(obj1.x-obj2.x)),2),.5))/Math.PI
More accurate.
just so you dont get totaly confused, everyone except for Nisas is screwing with you
Basicly, its like a right angled triangle. think of the y as the upright line, x as the horozontal line and the line connecting the two is a, or the distance. now to work out a, the formula is this:
a^2 = X^2+Y^2
so
a = square root(x+y)
so (in AS)
xdist = mc2.x - mc1.x
ydist = mx2.y - mc1.y
distance = Math.sqrt((xdist*xdist)+(ydist*ydist)) At 12/18/09 02:16 PM, Cojones893 wrote:At 12/18/09 12:26 AM, Glaiel-Gamer wrote: Math.tan(Math.atan(enemyx-playerx))You missed a part
Math.PI*(Math.pow(Math.pow(Math.tan(Math .atan(obj1.x-obj2.x)),2),.5))/Math.PI
More accurate.
Can someone explain all that?
Math.PI*(Math.pow(Math.pow(Math.tan(Math .atan(obj1.x-obj2.x)),2),.5))/Math.PICan someone explain all that?
if you read it carefully, you'll see its just a long complex formula which cancels out, giving you a end result of obj1.x-obj2.x i believe
At 12/18/09 02:58 PM, Yambanshee wrote:if you read it carefully, you'll see its just a long complex formula which cancels out, giving you a end result of obj1.x-obj2.x i believeMath.PI*(Math.pow(Math.pow(Math.tan(Math .atan(obj1.x-obj2.x)),2),.5))/Math.PICan someone explain all that?
Funny. So they're just messing with the dude. I knew you couldn't possibly get the distance without taking the y distance into account.
At 12/18/09 03:01 PM, 4urentertainment wrote: Funny. So they're just messing with the dude. I knew you couldn't possibly get the distance without taking the y distance into account.
He never asked for the vector difference, he merely asked for the x axis distance, not displacement.
Although practicality beats purity.
Errors should never pass silently.
In the face of ambiguity, refuse the temptation to guess.
At 12/18/09 03:10 PM, Montycarlo wrote:At 12/18/09 03:01 PM, 4urentertainment wrote: Funny. So they're just messing with the dude. I knew you couldn't possibly get the distance without taking the y distance into account.He never asked for the vector difference, he merely asked for the x axis distance, not displacement.
Really...Now that I read the post again, that does seem as what he wanted. I just figured he couldn't have wanted something that simple.
I just want to know the difference between 2_x's. Very simple.
Not the difference between two objects. thanks.
You wouldn't drink dirty water, So why would you drink rotten milk? Oh, you wouldn't? in that case...
At 12/19/09 12:22 PM, RottenMilk wrote: I just want to know the difference between 2_x's. Very simple.
Not the difference between two objects. thanks.
Well its been stated above (unless you don't need help anymore cause I can't tell):
xDifference = object2._x-object1._x;
Replace the objects by enemy or player or whatever you want.