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

0 favourites
  • 6 posts
From the Asset Store
Forgotten Place - Melodic ambiance, background music, Synth
  • 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.

  • 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.

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • make negative conditions so the animation is not stoped by other events.

  • 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.

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