How do I animate health bar (lerp)

Get help using Construct 2

Post » Mon Sep 12, 2016 3:13 pm

Hi! I want to add lerp to my health bar, How I should put lerp in this code?
Thank you

Image
B
30
S
10
G
3
Posts: 25
Reputation: 4,228

Post » Mon Sep 12, 2016 3:53 pm

B
33
S
18
G
28
Posts: 2,475
Reputation: 20,914

Post » Mon Sep 12, 2016 10:06 pm

Thank you for your reply. What I want to do is when I sustract the player's life the bar goes down with lerp.
B
30
S
10
G
3
Posts: 25
Reputation: 4,228

Post » Mon Sep 12, 2016 10:41 pm

Where you currently set the width of the bar, in the every tick action, change the value to:

lerp( Self.Width , {NewValue} , dt * {factor} )

Where {NewValue} is the current equation you are using to determine the width of the bar, and where {factor} is the speed by which you want it to animate.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 237
Reputation: 2,296

Post » Mon Sep 12, 2016 11:01 pm

mrtumbles wrote:Where you currently set the width of the bar, in the every tick action, change the value to:

lerp( Self.Width , {NewValue} , dt * {factor} )

Where {NewValue} is the current equation you are using to determine the width of the bar, and where {factor} is the speed by which you want it to animate.


It worked! Thank you!
B
30
S
10
G
3
Posts: 25
Reputation: 4,228

Post » Tue Sep 13, 2016 7:54 am

Kermad wrote:Thank you for your reply. What I want to do is when I sustract the player's life the bar goes down with lerp.


Any difference between 'up' or 'down' with lerp? You wanted 'lerp' and that is exectly what i gave you.
B
33
S
18
G
28
Posts: 2,475
Reputation: 20,914

Post » Tue Sep 13, 2016 3:48 pm

99Instances2Go wrote:
Kermad wrote:Thank you for your reply. What I want to do is when I sustract the player's life the bar goes down with lerp.


Any difference between 'up' or 'down' with lerp? You wanted 'lerp' and that is exectly what i gave you.


Thank you for your help!
B
30
S
10
G
3
Posts: 25
Reputation: 4,228


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], troxx and 1 guest