[SOLVED] How do I lock a character into place...

Get help using Construct 2

Post » Tue Aug 11, 2015 6:28 pm

I'm trying to build a platformer in which the main character attacks with kicks. The animations work fine (haven't worked out how to actually make the kicks affect targets yet but I'll get there) but I want to make it so the player can't move during the kick animation (similar to how you're locked in place while attacking in a 2D Castlevania game, for example). I find that if I rapidly press the attack button while holding left or right (to move), the character will eventually slide a bit during the kick animation and then go into the run animation. I've tried everything I could think of (which isn't much given my limited experience) to lock the character in place during the attack but it continues to occur.

I've never attached a .capx file before; hope I've done it right: https://drive.google.com/file/d/0B5PXjj ... sp=sharing

Thanks in advance for all your help.
Last edited by Dualmask on Tue Aug 11, 2015 9:21 pm, edited 1 time in total.
B
10
S
2
Posts: 31
Reputation: 759

Post » Tue Aug 11, 2015 7:16 pm

I'm not 100% sure, but what about adding a timer that starts when C is pressed that lasts for like 0.5 sec to check if C has been pressed again. If not then let the user move again.
Image
B
14
S
4
Posts: 145
Reputation: 1,948

Post » Tue Aug 11, 2015 7:35 pm

Make event where if animation "Kick" is played the platformer max speed is 0 and when it ends it goes back to default speed.
B
11
S
4
Posts: 53
Reputation: 1,148

Post » Tue Aug 11, 2015 8:35 pm

Human wrote:Make event where if animation "Kick" is played the platformer max speed is 0 and when it ends it goes back to default speed.


Thanks, that almost worked. Only thing is now if I press the Kick button, the character freezes and I have to press it again to make her attack or move. I'm going to keep tweaking it and see if I can't figure out what to do about that. Maybe a combination of your solution and the aforementioned timer approach will help.
B
10
S
2
Posts: 31
Reputation: 759

Post » Tue Aug 11, 2015 9:05 pm

make negative conditions so the animation is not stoped by other events.
B
11
S
4
Posts: 53
Reputation: 1,148

Post » Tue Aug 11, 2015 9:17 pm

Human wrote:make negative conditions so the animation is not stoped by other events.


Thanks a lot, Human, that helped me figure it out. I coded it so that if the Kick animation is playing, the Platform behavior is disabled, and it's re-enabled when the animation is finished...works as intended. She stops to kick no matter how much I mash the attack button while trying to run. Seems so simple now that I think about it... my file is probably loaded with a whole lot of redundant events.
B
10
S
2
Posts: 31
Reputation: 759


Return to How do I....?

Who is online

Users browsing this forum: TRMG and 32 guests