How do I effect velocity on slope?

0 favourites
  • 3 posts
From the Asset Store
Wind effect
$2.49 USD
Animated wind effect for objects, grass, trees, etc.
  • Hi there,

    I'm working on a bicycle-side-view platformer, and I'm wondering how I could change the Players velocity depending on the slope of the current map, i.e., getting a bit faster when riding down hill and slower when riding upp hill.

    I've tried a few things with the Platform Behaviour as well as with the Physics Behaviour (e.g., to subtract some value (depending on the angle) from accelaration, which results in no speed at all very fast; when I do it within a "trigger once" condition, I don't know how to restart the condition as soon as the angle changes again...), but it didn't worked out so far. Damping, Friction and so on do not help either.

    Any suggestions, what I could try?

  • I don't use the physics behavior myself but if I remember correctly it doesn't play well with other behaviors. If you use it, you'll want to remove the platform behavior and then program your movement with the physics behavior accordingly. Then sliding down slopes etc. should work as expected.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have some tips for controls with the physics behavior. I would suggest using the actions "apply force at angle" and "apply impulse at angle" for your controls

    So, for example, an acceleration would be

    "apply physics force 10 at player.angle"

    Deceleration would be

    "apply physics force 10 at player.angle+180"

    Jumping would be

    "apply physics impulse 2 at player.angle + 270"

    And to see if your player is on the ground (useful for jumping that makes sense), you could use the pin behavior to pin a slightly larger sprite over your player sprite (position and angle), then check if that larger sprite is overlapping the object you use for the ground.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)