posted something just now without noticing this post, so read the post above if you're just reading this

[QUOTE=Spider_hip] I couldn't get distance function. How can you divide a value which includes 4 values to a value ?

distance(Sprite2.x,Sprite2.y,Sprite.x,Sprite.y)/global('maxdistance')

Is there any document that I can find all usable functions on construct with their meanings ?

Thank you very much.

[/QUOTE]

all the usable expressions you can get when you're in that expression editor(anywhere you can type these expressions)

doubleclick on the system icon, and it gives you a list

this list is also handy:

http://sourceforge.net/apps/mediawiki/construct/index.php?title=System_Expressionsthe distance expression returns the distance between two points

distance(point1x,point1y,point2x,point2y)

it's the same as using the pythagorean theorem, but that doesn't matter, because you don't need the details to make it work. but it returns one value representing the distance between the first and second point

so you can use it to find out how far away two objects are in pixels

as far as why use the division problem,

when you divide any value by some maximum value, you get a decimal value that represents what portion of the whole you have like

let's say your max is 4

0/4==0

1/4==0.25

2/4==0.5

look familiar? it works in alot of situations to give you that perfect value for t in

lerp(a,b,t)

we used clamp, because we want to force the values to stay between 0 and 1, so the speed we choose for things getting sucked in the black hole won't get blown away from the black hole when they get too far because

lerp works with larger and smaller numbers for t

like lerp(0,10,2.0)==20

or lerp(10,0,2.0)==-10

or lerp(0,10,-0.5)==-5

lucid2011-07-19 11:43:48