Platform behavior - Deceleration when turning around

New releases and general discussions.

Post » Thu Jan 08, 2009 1:58 am

This is something I've found very odd with the platform behavior. It's a lot more noticable at high speeds. When a sprite with a platform behavior is walking in one direction, and th player suddenly makes him/her turn the other way, the object does not slow down in the direction that it was going in. However, when the player releases the movement keys, the object slows down. Am I the only one who sees this as a problem?

Really, it would be more realistic for the character to decelerate quicker by moving in the other direction than just stopping. Maybe there should be an option for this? It just seems... Jarring, at the moment.
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Thu Jan 08, 2009 2:16 am

I tried the Simple Platformer template, and it does have acceleration when you change direction. It doesn't change direction instantly like you describe. Maybe your Floor Acceleration/Deceleration values are wrong?
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Thu Jan 08, 2009 2:21 am

Er... beaten by Ashley but I'll post anyway.

Play with the floor/air acceleration and deceleration until you get the effect you're looking for. For instance, setting the deceleration very high (in the thousands) will stop the player instantly upon releasing the key.

If you want it to look like you player is turning around faster than he can stop, then set the acceleration higher than the deceleration.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jan 08, 2009 2:57 am

I think you misinterpreted what I meant. Deadeye knows what the heck I mean, now. If you want to see the effect I'm talking about, here's a cap that Deadeye made:

http://willhostforfood.com/files3/6094689/sliding.cap

Now, when playing, get a good run-up, find a good stopping point, and then do two tests. For the first test, let go of the keys, the player should stop fairly quickly. For the second test, instead of letting go of the keys, quickly switch to pressing down on the opposite movement key. The character will slide much further.
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Thu Jan 08, 2009 3:00 am

He's right, it does act funny. Stopping happens quickly but when turning around you sliiiiiiide for a long way.

At higher acceleration and deceleration values it's not as noticeable, but since he's trying to recreate Sonic's movement, it's very noticeable.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jan 08, 2009 3:21 am

I don't think its anything unusual. It's just that the floor acceleration is much lower than the deceleration.

When you let go of all the controls, you decelerate to a stop (at the floor deceleration rate).
When you press the opposite direction, you accelerate in the opposite direction (at the floor acceleration rate).

So yes, if you set the acceleration much lower than the deceleration, you'll get this slightly weird behavior. It doesn't seem to be a problem with the whole movement - just this specific combination of settings. Perhaps it would be more realistic, if you are changing direction, to add the deceleration and acceleration rates together. Then when you start accelerating in the direction of the arrow key you are pressing, it carries on at just the acceleration rate.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Thu Jan 08, 2009 4:12 am

[quote="Ashley":3ur00a0a]Perhaps it would be more realistic, if you are changing direction, to add the deceleration and acceleration rates together. Then when you start accelerating in the direction of the arrow key you are pressing, it carries on at just the acceleration rate.[/quote:3ur00a0a]

Yes, I think that's the effect he's going for. It does seem strange that when stopping you slide say ten feet in the direction you were going, but when turning around you slide twenty feet. Turning around should make you slide less than stopping, not more, no matter what your acceleration is set to.

Even if your acceleration was set to 1 you should slide just about as much when turning around as you do when stopping.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jan 08, 2009 9:27 pm

That is pretty trippy. Maybe if you think hard enough you can find a real life situation to match. Maybe it's like when you're in a car on ice and slamming on the breaks sends you into a slide.

But if you ask my two cents ...

...

... well I'll give it anyway. I would think most objects will come to a stop in about the same time whether they're planning on heading the opposite direction afterward or just remaining stationary.
B
3
S
2
G
4
Posts: 271
Reputation: 2,017

Post » Fri Jan 23, 2009 8:54 am

I too have found this problem rather annoying, since its impossible to have a character that accelerates slower than he decelerates and still having the movement relatively sane. However, I would say that its still a problem if you have a higher acceleration than deceleration since this will still provide a slower change of speed than it should. I guess what Im saying is that acceleration and deceleration should always be summed together when turning around. Also, in my opinion, any good platformmovement should have higher deceleration than acceleration (as in Mario, Sonic, Wonder boy and many others) and this is simply not doable right now (at least without making some events of your own). I actually for a time thought this was something that was going to be fixed, but now I have learned to manage anyway.
B
2
G
4
Posts: 16
Reputation: 1,082

Post » Fri Jan 23, 2009 4:18 pm

I made a workaround for this situation, but I too found it to be a pain.

+"Move Left" is down
+Not "Move Right" is down
-Player: Set angle to 180
-Player: Set acceleration to 300
++Player[Platofrm].VectorX Greater than 0
--Player: Set acceleration to 1500


Perhaps the behavior could include a feature like this by default? Even better than just setting the acceleration to a particular number, you could make the turnaround acceleration to acceleration + deceleration.
B
2
G
3
Posts: 71
Reputation: 992

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 1 guest