Slideshow: Scrolling Using Button triggers (lerp)

Get help using Construct 2

Post » Thu Jun 27, 2013 3:13 pm

You didn't understand the goal of clamp. clampx(val,min,max) is a function that will return :
val if min<val<mx
min if val < min,
max if val > max
By changing like you did, you set the minimum progress to 0.5, so the movement was half done from the start.
I modified your last capx to include a textbox for you to change the speed on the go, and see how it works. On my computer, you could clearly see the difference between 0.1 and 10 for example.
Posts: 473
Reputation: 6,321

Post » Thu Jun 27, 2013 5:23 pm

Cheers @Guizmus I think I get this now. . .

The 'Speed' Global Variable adjusts the movement speed between 0 and 1.
(I didn't type in a decimal number like 0.1)

Set progress to clamp(progress + dt*Speed, 0, 1 <--Breakdown

1. Clamp regulates movement between, under or over the minimum & maximum (0 & 1)
The value will return to a position if X-Value is lower than the minimum, hence being able to scroll back if you press a button for the 2nd time.

2. 0 and 1 represents non-movement & movement. When I added 0.5,1 at the end of "dt*Speed" it seemed faster because the scroll began in mid-movement (0.5)

3. I'm not sure what the 'Progress' variable does. I initially thought it was the Speed Global Variable. I then thought 'Progress' meant movement or non-movement, like a toggle switch. 0=false. 1=True

I really appreciate your example, I'm enjoying learning how to solve these logic puzzles. I hope I understand the concept of Clamp now, I read the manual.

AleXNECROKRIEG2013-06-27 17:30:39
Posts: 87
Reputation: 4,304


Return to How do I....?

Who is online

Users browsing this forum: sonicwiz and 1 guest