How do I make Player roll while moving

Get help using Construct 2

Post » Thu Sep 11, 2014 11:44 pm

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!
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Fri Sep 12, 2014 2:17 am

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.
[b]Andrew Donelson[b]
Nlaak Studios, LLC
https://www.nlaak.com/
[email protected]
B
15
S
3
Posts: 66
Reputation: 1,136

Post » Fri Sep 12, 2014 11:24 pm

@nlaakald, 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!
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Sat Sep 13, 2014 12:21 am

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.
[b]Andrew Donelson[b]
Nlaak Studios, LLC
https://www.nlaak.com/
[email protected]
B
15
S
3
Posts: 66
Reputation: 1,136

Post » Sat Sep 13, 2014 2:44 am

Here. is this what you are trying to do? It's kinda quick and dirty but you get the idea.
You do not have the required permissions to view the files attached to this post.
[b]Andrew Donelson[b]
Nlaak Studios, LLC
https://www.nlaak.com/
[email protected]
B
15
S
3
Posts: 66
Reputation: 1,136

Post » Sat Sep 13, 2014 11:52 pm

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 :)
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Sun Sep 14, 2014 12:37 am

ok kewl. np anytime.
[b]Andrew Donelson[b]
Nlaak Studios, LLC
https://www.nlaak.com/
[email protected]
B
15
S
3
Posts: 66
Reputation: 1,136


Return to How do I....?

Who is online

Users browsing this forum: Christmas and 47 guests