How do I use lerp to make the hero bouncy/squishy looking?

Get help using Construct 2

Post » Wed Nov 09, 2016 7:56 pm

Is there a way to use lerp or some other function to give my main character a "bouncy" or "Squishy" look when it jumps, lands and moves? I've seen some tutorials on how to make grass and bushes move when you walk past them and I tried to apply similar settings but I haven't used C2 in so long now I've completely forgot what I was doing.

Thanks!
B
12
S
4
G
2
Posts: 132
Reputation: 1,749

Post » Wed Nov 09, 2016 11:40 pm

A simple way to make a character "squish" when landing is the following:

On Landed:
Player - set height to self.height*0.8
Player - set width to self.width*1.2
System - wait 0.1 seconds
Player - set height to self.height/0.8
Player - set width to self.width/1.2

Basically, this will "compress" the sprite, making it look wider and shorter for a moment, then quickly go back to normal.

I'm not sure what sort of visual effect to expect from a squishy character jumping or walking around, though - if you have something in mind, let me know and I'll see if I can help. Good luck!
B
13
S
2
Posts: 19
Reputation: 768

Post » Mon Nov 28, 2016 9:44 pm

That's a real nice effect, thanks
B
12
S
3
G
2
Posts: 38
Reputation: 1,394

Post » Wed Nov 30, 2016 5:50 pm

gwerneck wrote:A simple way to make a character "squish" when landing is the following:

On Landed:
Player - set height to self.height*0.8
Player - set width to self.width*1.2
System - wait 0.1 seconds
Player - set height to self.height/0.8
Player - set width to self.width/1.2

Basically, this will "compress" the sprite, making it look wider and shorter for a moment, then quickly go back to normal.

I'm not sure what sort of visual effect to expect from a squishy character jumping or walking around, though - if you have something in mind, let me know and I'll see if I can help. Good luck!


You can apply lerp to that too, to smooth it out.

Something like:
Code: Select all
static x = 0;
static landing=0;
Every tick:
Player set height lerp(0.8,1.2,x)
Player set width lerp(0.8,1.2,1-x)
if x >= 0 && landing==1: subtract dt from x
if x <= 1 && landing==0: add dt to x
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824


Return to How do I....?

Who is online

Users browsing this forum: dop2000, namaewayukidesu and 10 guests