# manual not precise enough for some expressions.

If you have found a bug, or have a suggestion/comment then leave it here

### » Tue Aug 12, 2014 10:09 pm

The page of the system expressions ( https://www.scirra.com/manual/126/system-expressions ) state currently that CanvasToLayer and LayerToCanvas functions take (layer) as a parameter, in fact they take 3 parameters:
CanvasToLayerX(layer, x, y)
CanvasToLayerY(layer, x, y)
, same parameters for Layer to canvas.

Not a big issue, but since it is correctly stated in C2 itself, I might as well indicate it inside the manual.

Also an exemple for the lerp would be appreciable, since I see a lot of people using it in a non intended way (just an exemple saying if x = 0, returns a, if x=1, returns b, if x = 0.5, returns (a+b)/2 ), but it is only a suggestion (the way people are using it is to set x to a constant, and set a to lerp(a, b, x), which results in a movement towards b, slowing when approching b, never reaching b, and that leaded the community into saying sentences like "the sprite is lerping to this position", "lerp is meant to be use to do an ease in movement", which just does not make any sense, and also tends to make people think x should be multiplied by dt to be framerate independant, which won't work since x is not a time of any kind).
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

### » Tue Aug 12, 2014 10:56 pm

If I say x=x+1.
What is x on the next tick if x was 0 to begin?
Lerp( self.x,target.x,something*dt) changes self.x because you told it to move some fraction(something*dt), or percent toward the target.x
If you change something*dt to 0 then it will move 0 percent of the interpolation(movement) of self.x, to target.x.
That is framerate dependent.
It is not meant to be pixel perfect, or to ever get exactly to target.x.
B
173
S
50
G
195
Posts: 8,574
Reputation: 121,884

### » Wed Aug 13, 2014 12:30 pm

Thanks, I've updated the CanvasToLayer and LayerToCanvas expressions. I don't think there's much to add to lerp in the manual - "Linear interpolation of a to b by x. Calculates a + x * (b - a)." is pretty concise and accurate, and it's up to the user what you do with that.
Scirra Founder
B
408
S
242
G
92
Posts: 24,929
Reputation: 198,706

### » Wed Aug 13, 2014 1:50 pm

Thanks, will try to see if there are other unconsistency between the manual and C2 itself
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150