The Daily Click ::. Forums ::. Klik Coding Help ::. Quick question
 

Post Reply  Post Oekaki 
 

Posted By Message

0ko



Registered
  11/01/2009
Points
  318
22nd February, 2009 at 22:15:32 -

I want to set an alterable value relative to and objects x position that's relative to another objects x position.

In the expression editor I have : set alterable value A relative to X("active")

I don't know where to go from there... help?!


Edited by 0ko

 
n/a

-Dark Martin-

The dark is most certainly not your friend

Registered
  05/06/2008
Points
  21

Has Donated, Thank You!KlikCast StarSonic SpeedWii Owner360 Owner
22nd February, 2009 at 22:26:07 -

If you explain a little more carefully i can answer that.o_O

 
<a href="http://s50.photobucket.com/albums/f315/Martin_Bodger/?action=view¤t=signature_stripcopy.png" target="_blank">Image

steve



Registered
  13/09/2002
Points
  200

VIP Member
22nd February, 2009 at 22:33:43 -

do you mean comparing a distance between one object and another?

 
n/a

0ko



Registered
  11/01/2009
Points
  318
22nd February, 2009 at 22:34:41 -

ok like,heres how it would look in the expression editor:

set alterable value a
X("active")

but I want active x to be relative to another objects position that I'm setting alterable value A to.

hope that makes sense!

and Steve,it's not that simple,I know how to do that,but it's like...um
comparing them when the first part of comparing them hasn't been done yet.

like instead of something simple like set x position relative to X("active")
it's setting an alterable value to it,then setting it relative to another active.
Gosh this is hard to explain.


Edited by 0ko

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
22nd February, 2009 at 23:56:30 -

Depending on whether the first object is to the right or the left of the second object, just do X("Active") - X("Active 2") or the reverse. That will make it relative.

Edited by OMC

 

  		
  		

0ko



Registered
  11/01/2009
Points
  318
23rd February, 2009 at 01:01:35 -

yes...but say we took Y into account...

does that mean I gotta make like 6 events for say,top left,top right,bottom left,bottom right?

Edited by 0ko

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
23rd February, 2009 at 03:07:52 -

Well, if the relative X and Y formulas are stored separately, then just do another for the Y. Otherwise I'd say yea, do the 4 events.

If you need it to be exact distance from the other object and not an X or Y difference, then use the distance formula ( Square root of((X1 - X2)(X1 - X2) + (Y1- Y2)(Y1 - Y2))) or a math extension to determine the distance between the objects.

Maybe I'm misunderstanding the problem... but both bases have been covered so I don't see what else it could be. Maybe you could clarify?

Edited by OMC

 

  		
  		

0ko



Registered
  11/01/2009
Points
  318
23rd February, 2009 at 18:58:24 -

that formula is what I needed! thanks OMC.

but uh,I'm not sure how to type it out,I did it this way and got a syntax error:

( Square root of((X( "Active" ) - X( "Group.1" ))(X( "Active" ) - X( "Group.1" ) + (Y( "Active" )- Y( "Group.1" ))(Y( "Active" ) - Y( "Group.1" )))

the whole reason I'm doing this is for rts style movement,It figures out the distance of the Cursor (which is active 1) from the player that is selected (group.1).

Edited by 0ko

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
23rd February, 2009 at 19:05:44 -

Oh, well that's not the correct syntax. I don't know if MMF2 has a built-in square root function, I use an extension in TGF1 for that. Find the best way to get a square root, and voila.

 

  		
  		

0ko



Registered
  11/01/2009
Points
  318
23rd February, 2009 at 19:40:03 -

Turns advanced direction object was what I needed,but...now I have another problem,LOL.

how to you use percentages in the expression editor?


oh wait,never mind,I found a different way to fix it. thank you very much for your help.

Edited by 0ko

 
n/a
   

Post Reply



 



Advertisement

Worth A Click