How do I make Player roll while moving

0 favourites
  • 7 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Sorry for the not so explanatory title.

    So to put it simple, I've been banging my head for days trying to figure out what's wrong with the method I'm using.

    What I would like to accomplish is for my character to do a roll animation while walking or running.

    So I thought it would be simple since all I would have to do is something similar to what I did with crouch, but with no luck.

    This is the link to the capx file: https://www.dropbox.com/s/7iq6p7pwzd7cnj2/test_03.capx?dl=0

    the controls are:

    left and right arrows = running

    left and right arrows + x key = walking

    up = jump

    what I did for crouch can be found in Player Controls and animations are in Player Animations sheet.

    So if anyone could point me out my error, I would really appreciate it

    Thanks in advance!

  • Im not at the house atm but without looking at your code the difference between crouch and roll is your not moving. When you play an animation effect (like Roll) and you do not keep your object moving manually then it must have its own velocity. For example your player starts off running, it takes 3 secs to get to players max speed, when the player rolls the friction lowers his speed by X% and so on. I think you see where i am going with this. Try using input to change your players velocity up and down, run the animation of walking/running as a percentage of the velocity and I bet your roll with work even better than you wanted.

  • , Thanks for your anwer.

    So what you mean is that while let's suppose running, if I press down key I should reduce the velocity by a percentage?

    I'll try this and post the results later.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You don't have to, just using physics to give it a realistic effect. I know box2D has friction and such because that's what I built my engine on so your problem could be friction is being applied to your object. I have not played with any of that yet with construct 2 but that's where I would look. If you cant find it ... im sure there are plenty of us here that can help you. just extract the events and layout for that one part and we'll take a look.

  • Here. is this what you are trying to do? It's kinda quick and dirty but you get the idea.

  • Yes, well sort of. But I got it working in another way.

    What I did was add a bullet behaviour to my PlayerDetect so each time I press an input the bullet behaviour is activated and makes the Player move distance x. After its finished, the behaviour is deactivated. Works well for now. Had a couple of issues with other controls but managed to fix it.

    Thanks for your help

  • ok kewl. np anytime.

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