The Daily Click ::. Forums ::. Klik Coding Help ::. Help with distance
 

Post Reply  Post Oekaki 
 

Posted By Message

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
17th March, 2007 at 19:40:42 -

I posted about this before but i was misunderstood cause the math formula with some atan smatan is for natan.

This is exactly what i want, i want to calculate the distance in pixels between two objects in a circular way. And then multiply it with 16.

I dont want any extensions or imposible things.

And then maybe just simple direction from it but it is not needed.

Example bellow

 
Code me a sausage!

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
17th March, 2007 at 19:43:59 -

Image

I just need to compare with alterable value is enemy in circular range of lets say 200 pixels of JOE's range or not.

Please just help me.:"!!!

Oh and this should be calculated when u click with right mouse button on the enemy.

The
OK sry i posted bout something else before... .i need this thing.

Image Edited by the Author.

Image Edited by the Author.

Image Edited by the Author.

 
Code me a sausage!

Hernan



Registered
  04/03/2003
Points
  707

VIP Member
17th March, 2007 at 20:05:16 -

Ever heard of Pythagoras's theorem?
x^2+y^2=r^2 with r being the distance.

 
This space is for rent

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
17th March, 2007 at 20:47:04 -

Or in MMF language:

Distance = sqr(abs(X2 - X1) pow 2 + abs(Y2 - Y1) pow 2)

Image Edited by the Author.

 
n/a

Fifth

Quadruped

Registered
  07/05/2003
Points
  5818

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
17th March, 2007 at 20:56:20 -

No need for the abs(), axel. A negative number squared will give you a positive result.

 
Go Moon!

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
17th March, 2007 at 20:57:49 -

Haha, yeah I noticed. I was just editing my reply when you posted <_<

 
n/a

Fifth

Quadruped

Registered
  07/05/2003
Points
  5818

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
17th March, 2007 at 21:00:04 -

Gwahaha!

 
Go Moon!

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
18th March, 2007 at 10:42:38 -

Thx, i really suck at math things.
'?
One more question does mmf round down the numbers like this?

I set a counter to see which numbers i am getting, i divided them with 16 at the end because i am using 16x16 tiles. so a unit standing right next to Joe is 1 the next is 2 then 3 and so on. Units that are one 16x16 tile down and left gets 1.4 while unit at 2 down 2 left gets 2.8

Does mmf round down 1.4 to 1 and 2.8 to 3 because thats the way i want to round up for comparing with alt values.?

And is there some command in expression editor that will round up that numbers in the counter for me. So I only see round numbers.

Image Edited by the Author.

 
Code me a sausage!
   

Post Reply



 



Advertisement

Worth A Click