Gradually change player's angle on a slope/ramp?

Get help using Construct 2

Post » Tue Aug 20, 2013 10:34 pm

Hello All!

I am trying to make the player's angle change gradually when he is walking on a ramp/slope (using the platform behavior).

I searched and found this nice example by JohnnySix (Platform movement with Ramps), but this changes the angle instantly. I want to use the lerp expression to make the transition between the angles more gradual. But I am encountering the following problem:

When the angle has a negative value in relation with the player's "0" angle reference, the rotation is going berserk! I admit, it does produce an interesting effect, like a tumbling, but it's not the result that I am after. With positive angles, the outcome is different.

You can observe the problem here.

And here is the capx file.

Use the arrow keys to move...

Can someone help me with this problem??? Or is there any other way to achieve the same result, I mean for the player to follow the curvature of the ground and change it's angle respectively??

Thank you in advance!!!

Elias
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Tue Aug 20, 2013 11:51 pm

I may be able to help with this as I was facing something similar recently, something to do with weirdness about handling -angle values, but I have my own noob question first.

It says the version of that capx was saved in release 141 or newer, so I can't open it. Where can I download that release version? I only see 139 on the site. Let me know so I can try and help :)
B
11
S
2
Posts: 87
Reputation: 1,112

Post » Wed Aug 21, 2013 12:37 am

@Wertle

r141 is the latest beta version available hereplinkie2013-08-21 00:37:36
B
47
S
17
G
81
Posts: 2,222
Reputation: 48,091

Post » Wed Aug 21, 2013 12:58 am

@Wertle,

Hello, thanks for your reply!

I jumped the gun and installed the latest beta because I wanted to test the ability to change global variables in the debugger and see the results in real time...

As plinkie kindly points out, there is an r141 beta release.

I am anxious to see what solution you came about to this problem!

Thanks!

Elias
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Wed Aug 21, 2013 1:12 am

So my theory about negative angles wasn't right, but I was able to get what you want using "Rotate Towards Angle" instead of "set angle"

http://storage.wertle.com/construct2/SlopeAngleFixed.capx

You can change the angle number to get a faster or slower transitionWertle2013-08-21 01:13:36
B
11
S
2
Posts: 87
Reputation: 1,112

Post » Wed Aug 21, 2013 1:29 am

Dear @Wertle,

Thank you so much!!!

Elias
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Fri Jan 03, 2014 8:08 am

Hi.

Apologies for reviving old thread.
Why can i not call on object.Angle ?
Why do i have to use an instance variable instead?

The reason i ask is, it would save a lot of time during level design to just look at the solid's angle as opposed to adding slope helpers all over the terrain and manually adjusting the instance variable to match to angle degrees of the slope.
B
8
S
2
Posts: 163
Reputation: 1,115

Post » Thu Jan 09, 2014 9:43 am

@Ldk

I am afraid I don't know how you could do that.

Perhaps someone more experienced than me (honestly, I just barely understand the program and it's true potential) can add to your question some useful input.

Why don't you make a new topic?

Or ask Ashley?

-EDIT-

I figured out a way, not very precise, not very elegant and it will produce some jerky results but, for all it's worth, here it is:

Get Angle From Ground



eli0s2014-01-09 10:28:06
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Thu Jan 09, 2014 1:28 pm

When using lerp for angles you have to use anglelerp! This got me stumped a few months ago too.
B
125
S
43
G
41
Posts: 849
Reputation: 28,260

Post » Fri Jan 10, 2014 2:56 am

Thank you @andreyin , that's useful to know!
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests