0 Favourites

How do I roll on a slope

  • When I add a slope sprite to my game and setup the behaviors for it, the ball doesn't roll up or down the slope, instead it just stops. It basically just rolls "into" the slope a little, then you have to jump and move right a bit. As you can see below:

    [attachment=1:2bxxp551][/attachment:2bxxp551]

    [attachment=2:2bxxp551][/attachment:2bxxp551]

    How do I get the ball to roll up and down a slope?

    P.S.

    For each slope object and part thereof, I have set "Physics" behaviour to it and Set "Immovable" to "Yes" and set "Collision mask" to "Use collision polygon" - I've also tried setting it to "Bounding Box" with no luck.

  • Could you provide a capx. or make a new small capx that illustrates your problem, then it could be easier for us to debug.

    Have you made sure your collision polygon follows the edge of the slope as you would expect?

  • Thanks cvp - I have now uploaded the capx file. Could you please check it out?

  • As i expected, and wrote in my post

    You need to fix your collision polygon:

    Edit your image and select the collision polygon editor in the bottom of the menu on the left.

    Then move the red corners to match your tiles outline better (you can add more delete corners etc)

    You need to make it look like this:

    That should do the trick

  • Wow, thanks so much cvp! I haven't been able to test the result after following these instructions though because for some reason I now keep getting an error when I Run the layout:

    ---------------------------

    Message from webpage

    ---------------------------

    Assertion failure: undefined

    Stack trace:

    Error

    at assert2 ()

    at SetAsVector ()

    at SetAsArray ()

    at createBody ()

    at postCreate ()

    at createInstanceFromInit ()

    at createInitialInstances ()

    at startRunning ()

    at go_textures_done ()

    at go ()

    ---------------------------

    OK

    ---------------------------

    Do yoy know what causes that?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Not from that no. sry. (capx debugging is hard without the capx)

    Try to revert the resent changes you have just made. You apparently did something Construct 2 didnt like

  • Update:

    If I click "OK" button on that error that pops up, the game still displays properly and I tested it and I was able to roll up and down the slopes perfectly

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