Distance, clamp and lerp in Stencyl.

Biruang

  • Posts: 147
Hello everyone! So I've got another problem here. A few months ago I've worked with Scirra Construct, where were system expressions like distance,clamp and lerp. Now I'm trying to do similar in Stencyl, but It won't work. Can anyone help me please?
I've attached some examples of my behavior. It looks like everything is right, but It still won't work properly.

In Updated Event:
Time - clamp(distance(Sprite3.X, Sprite3.Y, Sprite.X, Sprite.Y) / 256 - 0.5, 0, 1)
Height of self - lerp('oh', 'dh', 't')
Width of self - lerp('ow', 'dw', 't')
Angle of self - lerp('oa', 'da', 't')
T - cos('time' * 180) * -0.5 + 0.5

Clamp = clamp(x, lower, upper)
Return lower if x is less than lower, upper if x is greater than upper, else return x.

Distance = distance(x1, y1, x2, y2) Calculate distance between to points.

Lerp = lerp(a, b, x) Linear interpolation of a to b by x. Calculates a + x * (b - a).

In Created Event:
I think everything is fine, but I'm not sure about "oa"
Oa = Angle of Self
Is it right?

Please help me if you can and sorry for my bad english!
Best,
-Erick

« Last Edit: November 18, 2012, 11:15:36 am by Biruang »

chrizt

  • Posts: 345
you need to tell what were you trying to do using that behavior or someone cant see where the mistake is
need help with behavior? game design? graphic design? just contact me
skype : christian.atin
email : christianatin27@gmail.com

Biruang

  • Posts: 147
you need to tell what were you trying to do using that behavior or someone cant see where the mistake is
I've tested it on SC (with clamp,lerp and distance) and it works fine. Here I'm trying to do it with stencyl's blocks and it wont work. There must be a mistake, because I don't really know how to do it properly here.

PS. Im trying to make forming tiles, objects.

chrizt

  • Posts: 345
what is SC? source code? i dont really get what you mean by "forming tiles and objects" :(
need help with behavior? game design? graphic design? just contact me
skype : christian.atin
email : christianatin27@gmail.com

Biruang

  • Posts: 147
what is SC? source code? i dont really get what you mean by "forming tiles and objects" :(

Sorry, Scirra Construct.

Self-forming tiles. They are "creating" themselves when character moves.
Simular to one of the last levels of Metro 2033, if you had played one  ;)
http://www.youtube.com/watch?v=xvCotWsOHwI&feature=relmfu

Biruang

  • Posts: 147
what is SC? source code? i dont really get what you mean by "forming tiles and objects" :(

Sorry, Scirra Construct.

Self-forming tiles. They are "creating" themselves when character moves.
Simular to one of the last levels of Metro 2033, if you had played one  ;)
http://www.youtube.com/watch?v=xvCotWsOHwI&feature=relmfu

I can show Construct version, if needed.

chrizt

  • Posts: 345
if you mean creating a tile while gameplay then i am not sure that you can do it by using only blocks
need help with behavior? game design? graphic design? just contact me
skype : christian.atin
email : christianatin27@gmail.com

Biruang

  • Posts: 147
if you mean creating a tile while gameplay then i am not sure that you can do it by using only blocks
Only 1 tile/block will be fine. I can use it as an actor. And I don't need it to be created. They will be there at the beginning. They will just change their angle/width/height/size depending of player's coordinates. Character moves - they "form" themselves.