Moving the player with moving platform whilst jumping

Get help using Construct 2

Post » Thu Jan 01, 2015 11:41 am

I'm halfway to getting this to work, but it's still not 100% working.

Basically I want the player to move with a horizontal moving platform, whilst the player jumps on the platform. If you jump on a moving platform with the platform behavior, the player sticks to it and can move about no problem, but if you jump, then the player goes flying back, as they're no longer moving with the platform.

Right now I have it to set the X vector of the platform behavior to itself, if the player doesn't press any button whilst jumping. Then to allow the player to move around whilst they're jumping, I increase/decrease the max speed as required.

This works for the most part, however it ignores the acceleration and deceleration for the platform behavior, due to it needing to set the X vector to itself if the player isn't holding a direction. Does anyone know of a better way of doing this?

Many thanks!
B
3
Posts: 14
Reputation: 203

Post » Thu Jan 01, 2015 3:33 pm

I think what you're asking for is for the platform behaviour to behave more like the physics behaviour by preserving momentum. I think the only way to achieve what you want - consistent behaviour whether jumping off a platform or not - is to write your own x velocity code using events. It sounds like you've done that already for when the player jumps off a moving platform. For the rest, then, set the default platform deceleration to 0 and set x velocity to reduce to 0 as you have already. It might take a bit of experimentation to get the effect you want but at least then it'll be consistent wherever the player jumps. I've personally found the default behaviour OK for a quick prototype but things like this require some alternative behaviour writing using events.
A big fan of JavaScript.
B
74
S
20
G
69
Posts: 2,210
Reputation: 43,842

Post » Fri Jan 02, 2015 1:04 pm

Colludium wrote:I think what you're asking for is for the platform behaviour to behave more like the physics behaviour by preserving momentum. I think the only way to achieve what you want - consistent behaviour whether jumping off a platform or not - is to write your own x velocity code using events. It sounds like you've done that already for when the player jumps off a moving platform. For the rest, then, set the default platform deceleration to 0 and set x velocity to reduce to 0 as you have already. It might take a bit of experimentation to get the effect you want but at least then it'll be consistent wherever the player jumps. I've personally found the default behaviour OK for a quick prototype but things like this require some alternative behaviour writing using events.


Many thanks for the advice. I'll get right to it and start experimenting with some events to set the velocity!
B
3
Posts: 14
Reputation: 203


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 59 guests