Fill a bar smoothly

Get help using Construct 2

Post » Wed Feb 26, 2014 10:33 pm

i want in my game to have a bar that fills smootlhy.
it should start fast and then slow down when is nearest to fill.
right now im filling the bar with every 0.01 sec, but its allways the same speed..
i heard somewhere that lerp function could do the trick but im not sure how to use it.
if anyone can give me some help..
thank you
B
16
S
3
G
1
Posts: 85
Reputation: 2,260

Post » Wed Feb 26, 2014 10:55 pm

Here is an example of a lerping bar,
Lerp has 3 parameters :
- the minimal value
- the maximal value
- the step to take
If the step is 0, lerp will be the minimal, 1 will be the maximal.
By using "set Something to lerp(Something, GoalValue, Speed)", with :
- Something being your width in this example
- Goalvalue being the maximal width of the bar here
- Speed being tested with different values, you have 2 settings in the example.
You do not have the required permissions to view the files attached to this post.
B
17
S
8
G
4
Posts: 461
Reputation: 6,127


Return to How do I....?

Who is online

Users browsing this forum: htmlgames and 5 guests