How can I do this type of roll movement

Get help using Construct 2

Post » Tue Nov 17, 2015 2:37 am

Hey guys!
I ran into a big stopper here.
Im trying to make my character roll while running. The simple method is change speed and animation while moving.

But in my case, I would like to do as follows:

I press a key
Character does the rolling
If I press key to roll again, input is ignored until rolling is finished

In a nutshell, I would like to do something similar to Dark Souls rolling.

Thanks in advance!

Image
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Tue Nov 17, 2015 6:25 am

Hey Fraktal,

What I would do is give the player character a 'State' (instance text variable). When you roll you set the state to 'Rolling'.

Now for your general controls you can invert the condition: State=Rolling. This means that none of those controls will work until the state is changed to something else.

This way you can add special controls that will only work in that state, like what you need - the ability to roll again.
ImageImage
B
121
S
23
G
7
Posts: 1,070
Reputation: 13,039

Post » Tue Nov 17, 2015 5:10 pm

Hey Thanks GenkiGenka,

I tried with States. Actually my whole system is based on states, but when I tried using a isRolling state, the animation would play only the first frame.
What I have is

Press directional key
isRunStart which plays a run start animation
On runstart animation completed, isRunning = TRUE
On Dir. Key released, isRunning = FALSE Then isRunStop = True

I cant find a way to make it work in between those states,

My rolling so far works, but when I leave the key pressed, other animations wont play
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Fri Nov 20, 2015 1:48 am

Sorry for the late reply, if your animation is stuck on the first frame it will be because your calling it to play that animation (from the first frame) continuously. There is also an option to play it from the current frame.

If you put up a minimal cap.x I will fix it for you.
ImageImage
B
121
S
23
G
7
Posts: 1,070
Reputation: 13,039

Post » Sat Nov 21, 2015 3:15 pm

Hey GenkiGenga thanks! I think I fixed it but not completely sure. I can easily spam the roll action and the Wait didnt work as expected so I assume I'm still not doing it the right way. I'm sending you a stripped down capx file and I added a bookmark to where the whole code its located. Thanks for your time!
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Sat Nov 21, 2015 3:24 pm

FraktalZero wrote:Hey GenkiGenga thanks! I think I fixed it but not completely sure. I can easily spam the roll action and the Wait didnt work as expected so I assume I'm still not doing it the right way. I'm sending you a stripped down capx file and I added a bookmark to where the whole code its located. Thanks for your time!


**I forgot to mention in my private message. I switched most of the controls to a controller instead of keyboard so the character moves with the left trigger.
A button to jump, B button to roll and grab ledges.
B
43
S
12
G
14
Posts: 488
Reputation: 10,570


Return to How do I....?

Who is online

Users browsing this forum: Anonnymitet, tarek2 and 25 guests